!function(e, t) {
    "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).BMapGLDraw = {})
}(this, (function(e) {
    "use strict";

    var BMapGL = window.BM_BMapGL || window.BMapGL;

    function t(e, t) {
        (null == t || t > e.length) && (t = e.length);
        for (var n = 0, i = Array(t); t > n; n++)
            i[n] = e[n];
        return i
    }
    function n(e, t, n) {
        return t = l(t),
        u(e, c() ? Reflect.construct(t, n || [], l(e).constructor) : t.apply(e, n))
    }
    function i(e, t) {
        if (!(e instanceof t))
            throw new TypeError("Cannot call a class as a function")
    }
    function r(e, t) {
        for (var n = 0; t.length > n; n++) {
            var i = t[n];
            i.enumerable = i.enumerable || !1,
            i.configurable = !0,
            "value"in i && (i.writable = !0),
            Object.defineProperty(e, f(i.key), i)
        }
    }
    function o(e, t, n) {
        return t && r(e.prototype, t),
        n && r(e, n),
        Object.defineProperty(e, "prototype", {
            writable: !1
        }),
        e
    }
    function s(e, t) {
        var n = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
        if (!n) {
            if (Array.isArray(e) || (n = m(e)) || t && e && "number" == typeof e.length) {
                n && (e = n);
                var i = 0
                  , r = function() {};
                return {
                    s: r,
                    n: function() {
                        return e.length > i ? {
                            done: !1,
                            value: e[i++]
                        } : {
                            done: !0
                        }
                    },
                    e: function(e) {
                        throw e
                    },
                    f: r
                }
            }
            throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
        }
        var o, s = !0, a = !1;
        return {
            s: function() {
                n = n.call(e)
            },
            n: function() {
                var e = n.next();
                return s = e.done,
                e
            },
            e: function(e) {
                a = !0,
                o = e
            },
            f: function() {
                try {
                    s || null == n.return || n.return()
                } finally {
                    if (a)
                        throw o
                }
            }
        }
    }
    function a() {
        return a = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e, t, n) {
            var i = function(e, t) {
                for (; !{}.hasOwnProperty.call(e, t) && null !== (e = l(e)); )
                    ;
                return e
            }(e, t);
            if (i) {
                var r = Object.getOwnPropertyDescriptor(i, t);
                return r.get ? r.get.call(3 > arguments.length ? e : n) : r.value
            }
        }
        ,
        a.apply(null, arguments)
    }
    function l(e) {
        return l = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
            return e.__proto__ || Object.getPrototypeOf(e)
        }
        ,
        l(e)
    }
    function h(e, t) {
        if ("function" != typeof t && null !== t)
            throw new TypeError("Super expression must either be null or a function");
        e.prototype = Object.create(t && t.prototype, {
            constructor: {
                value: e,
                writable: !0,
                configurable: !0
            }
        }),
        Object.defineProperty(e, "prototype", {
            writable: !1
        }),
        t && p(e, t)
    }
    function c() {
        try {
            var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}
            )))
        } catch (e) {}
        return (c = function() {
            return !!e
        }
        )()
    }
    function u(e, t) {
        if (t && ("object" == typeof t || "function" == typeof t))
            return t;
        if (void 0 !== t)
            throw new TypeError("Derived constructors may only return object or undefined");
        return function(e) {
            if (void 0 === e)
                throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
            return e
        }(e)
    }
    function p(e, t) {
        return p = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
            return e.__proto__ = t,
            e
        }
        ,
        p(e, t)
    }
    function v(e, t) {
        return function(e) {
            if (Array.isArray(e))
                return e
        }(e) || function(e, t) {
            var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
            if (null != n) {
                var i, r, o, s, a = [], l = !0, h = !1;
                try {
                    if (o = (n = n.call(e)).next,
                    0 === t) {
                        if (Object(n) !== n)
                            return;
                        l = !1
                    } else
                        for (; !(l = (i = o.call(n)).done) && (a.push(i.value),
                        a.length !== t); l = !0)
                            ;
                } catch (e) {
                    h = !0,
                    r = e
                } finally {
                    try {
                        if (!l && null != n.return && (s = n.return(),
                        Object(s) !== s))
                            return
                    } finally {
                        if (h)
                            throw r
                    }
                }
                return a
            }
        }(e, t) || m(e, t) || function() {
            throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
        }()
    }
    function d(e, t, n, i) {
        var r = a(l(1 & i ? e.prototype : e), t, n);
        return 2 & i ? function(e) {
            return r.apply(n, e)
        }
        : r
    }
    function f(e) {
        var t = function(e, t) {
            if ("object" != typeof e || !e)
                return e;
            var n = e[Symbol.toPrimitive];
            if (void 0 !== n) {
                var i = n.call(e, t || "default");
                if ("object" != typeof i)
                    return i;
                throw new TypeError("@@toPrimitive must return a primitive value.")
            }
            return ("string" === t ? String : Number)(e)
        }(e, "string");
        return "symbol" == typeof t ? t : t + ""
    }
    function g(e) {
        return g = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
            return typeof e
        }
        : function(e) {
            return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
        }
        ,
        g(e)
    }
    function m(e, n) {
        if (e) {
            if ("string" == typeof e)
                return t(e, n);
            var i = {}.toString.call(e).slice(8, -1);
            return "Object" === i && e.constructor && (i = e.constructor.name),
            "Map" === i || "Set" === i ? Array.from(e) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? t(e, n) : void 0
        }
    }
    !function(e, t) {
        void 0 === t && (t = {});
        var n = t.insertAt;
        if (e && "undefined" != typeof document) {
            var i = document.head || document.getElementsByTagName("head")[0]
              , r = document.createElement("style");
            r.type = "text/css",
            "top" === n && i.firstChild ? i.insertBefore(r, i.firstChild) : i.appendChild(r),
            r.styleSheet ? r.styleSheet.cssText = e : r.appendChild(document.createTextNode(e))
        }
    }(".BMap_Draw_Panel{height:47px;border-radius:5px;overflow:hidden;box-shadow:0 2px 6px 0 rgba(27,124,236,.5);float:left}.BMap_Drawing .BMapDraw_Box{border-right:1px solid #d2d2d2;float:left;width:64px;height:100%;background-image:url();cursor:pointer}.BMap_Drawing .BMapDraw_last{border-right:none}.BMap_Drawing .BMapDraw_hander{background-position:0 0}.BMap_Drawing .BMapDraw_hander_hover{background-position:0 -52px}.BMap_Drawing .BMapDraw_marker{background-position:-65px 0}.BMap_Drawing .BMapDraw_marker_hover{background-position:-65px -52px}.BMap_Drawing .BMapDraw_circle{background-position:-130px 0}.BMap_Drawing .BMapDraw_circle_hover{background-position:-130px -52px}.BMap_Drawing .BMapDraw_polyline{background-position:-195px 0}.BMap_Drawing .BMapDraw_polyline_hover{background-position:-195px -52px}.BMap_Drawing .BMapDraw_polygon{background-position:-260px 0}.BMap_Drawing .BMapDraw_polygon_hover{background-position:-260px -52px}.BMap_Drawing .BMapDraw_rectangle{background-position:-325px 0}.BMap_Drawing .BMapDraw_rectangle_hover{background-position:-325px -52px}.BMapDraw_tip{position:absolute;top:50px;display:none;overflow:hidden;width:162px;height:40px;border:1px solid #ccc;line-height:20px;border-radius:4px;background-color:#fff;text-align:center;font-size:12px}.BMapDraw_tip_text{font-size:12px;color:#999}.BMapDraw_tip.polyline{right:135px}.BMapDraw_tip.rectangle{right:65px}.BMapDraw_tip.polygon{right:5px}.BMapDraw_tip.circle{right:-45px}.BMapDraw_tip p{margin:0}.screenshot{position:absolute;background:#fff;border:1px solid #e9e9e9;border-radius:2px;color:#333;padding:0 4px;font-size:12px}.screenshot .unit{display:block;color:#999;width:12px;float:right}.screenshot .circlShot{width:50px;text-align:center;line-height:30px;height:30px}.screenshot #screenshotNum{display:inline-block;height:30px;text-align:center;cursor:text}.screenshot #circleInput{display:none;border:none;width:34px;height:30px;margin-top:-1px;outline:none;-moz-user-select:none;user-select:none;-moz-appearance:listitem;appearance:listitem;-webkit-user-select:none;-webkit-appearance:listitem;padding:0;font-family:inherit;font-size:inherit;line-height:inherit;color:inherit}.screenshot #circleInput:focus{outline:none;border:none}.screenshot .rectWH{width:120px;height:30px;line-height:30px;padding:2px 0}.screenshot .rectWH span{display:inline-block;width:10px;text-align:center}.screenshot .rectWH .multiple{color:#999}.screenshot .rectWH .wh{display:inline-block;width:45px}.screenshot .rectWH .wh #rectHeight,.screenshot .rectWH .wh #rectWidth{width:33px;cursor:text}.screenshot .rectWH .wh #rectHeightInput,.screenshot .rectWH .wh #rectWidthInput{display:none;border:none;width:34px;height:30px;margin-top:-1px;outline:none;-moz-user-select:none;user-select:none;-moz-appearance:listitem;appearance:listitem;-webkit-user-select:none;-webkit-appearance:listitem;padding:0;font-family:inherit;font-size:inherit;line-height:inherit;color:inherit}.screenshot .rectWH .wh #rectHeightInput:focus,.screenshot .rectWH .wh #rectWidthInput:focus{outline:none;border:none;padding:0}.screenshot:focus-within,.screenshot:hover{border:1px solid #5e87db}.operateWindow{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.operateWindow>.containerbox{width:270px;height:35px}.operateWindow>div>span{display:block;float:left;margin:2px 0;text-align:center;cursor:pointer}.operateWindow div #confirmOperate{margin-left:15px;background:#fff url() no-repeat top;background-size:contain}.operateWindow div #cancelOperate,.operateWindow div #confirmOperate{float:left;width:50px;height:30px;box-shadow:0 2px 4px 0 rgba(0,0,0,.3);border-radius:2px}.operateWindow div #cancelOperate{margin-left:8px;background:#fff url() no-repeat top;background-size:contain}.operateWindow div #warnOperate{float:left;width:200px;height:30px;margin-left:4px;line-height:30px;background:#fffbcc;border:1px solid #e1e1e1;border-radius:2px;font-family:PingFangSC-Regular;font-size:14px;color:#703a04;letter-spacing:0;cursor:default}.operateLeft p span{float:right}");
    var y = {
        STATUS_FREE: "free",
        STATUS_DRAWING: "drawing",
        STATUS_EDITER: "editer",
        STATUS_MOVE: "move"
    }
      , b = {
        INIT: "operate-init",
        COMPLETE: "operate-ok",
        CANCEL: "operate-cancel",
        CHANGE: "operate-change",
        CLICK: "mouse-click",
        RIGHTCLICK: "right-click",
        MOVE: "mouse-move"
    }
      , w = {
        AREA_END: "measure-area-end",
        LENGTH_END: "measure-length-end"
    }
      , E = {
        DRAW_ON_MAP: "draw-on-map",
        EDIT_ON_MAP: "edit-on-map",
        SELECT_ON_MAP: "select-on-map",
        MOVE_ON_MAP: "move-on-map",
        DRAW_NO_MAP: "draw-no-map",
        SELECT_NO_MAP: "select-no-map",
        DRAW_ON_MAP_CANCEL: "draw-on-map-cancel",
        EDIT_ON_MAP_CANCEL: "edit-on-map-cancel",
        SELECT_ON_MAP_CANCEL: "select-on-map-cancel",
        MOVE_ON_MAP_CANCEL: "move-on-map-cancel"
    }
      , k = {
        DRAWING_POINT: "point",
        DRAWING_MARKER: "marker",
        DRAWING_POLYLINE: "polyline",
        DRAWING_POLYGON: "polygon",
        DRAWING_CIRCLE: "circle",
        DRAWING_RECTANGLE: "rectangle"
    }
      , M = "\n    AAAd9JREFUOBGtVc8rRFEUPufOvELMguTHwkbKjxRlo9gqNpjyFyhTit3I8i1ldpQa5S9QmA1lS9koSn6UZmMxSCyGkPlx3O+9mTe8Zl4z\n    w7eZ7rnn++aee893HlMRzEXFeLh6m2LJTpHwEJG022mcIJZTYbXX2lu/txnilJvO7sDkYnJaC0REqNO993PNTHEiDsfWAru/4vmFaYo6e3\n    5dEZIwYh1tPhobNmig20/NjcpKe3rJ0vlNmg5PUnR3n7FiTBwZbGpYNk3OIuCccHIhuQoxv49lNljD4yMG6VMUhT49HRynaGvnU9IZ0Wkc\n    ia0HlhxBlCkiOxAz5+u4v8tXVMgdvLjNkLnxbosyB1E+4wEeL5PXuLPQTC1NjBpunud6/yhF0e0PVBNv6Qv0KLwmxHBnKLNSgAMuNKClrN\n    bQKniAUnfm9SfggAtAS9l9RtZrehG99tAJFnTP6n6wmzbfGl7EUnsFrrTbDVYqs4q4FtR20kDTVosClxMK3oQQHFAtHK7WUjA6hGAnOKBS\n    gAMuAC2FqYGmhDdhp0oBDrjQgJayRxBbAwHehJ3KBXLBsfM5DC3H/v81HHIdSYQRpMcX6ekRhjcPjr/KGV+6Unt8xXJlOSfMl/lvAzYviN\n    +/fAK+AW5jAVefzjWGAAAAAElFTkSuQmCC"
      , L = new BMapGL.Icon("//mapopen.bj.bcebos.com/cms/images/mapctrls.gif",new BMapGL.Size(12,12),{
        imageSize: new BMapGL.Size(82,174),
        imageOffset: new BMapGL.Size(0,14)
    })
      , x = new BMapGL.Icon("//mapopen.bj.bcebos.com/cms/images/mapctrls.png",new BMapGL.Size(12,12),{
        imageSize: new BMapGL.Size(37,442),
        imageOffset: new BMapGL.Size(25,312)
    })
      , O = new BMapGL.Icon("//maponline0.bdimg.com/sty/map_icons2x/MapRes/shenghui_1.png",new BMapGL.Size(10,10),{
        offset: new BMapGL.Size(5,5)
    })
      , S = new BMapGL.Icon("//bj.bcebos.com/v1/mapopen-pub-jsapigl/bmap-draw/static/edit1.png",new BMapGL.Size(10,10),{
        offset: new BMapGL.Size(5,5)
    })
      , A = new BMapGL.Icon("//bj.bcebos.com/v1/mapopen-pub-jsapigl/bmap-draw/static/edit2.png",new BMapGL.Size(10,10),{
        offset: new BMapGL.Size(5,5)
    })
      , P = {
        borderRadius: "2px",
        background: "#FFFBCC",
        border: "1px solid #E1E1E1",
        color: "#703A04",
        fontSize: "12px",
        letterSpacing: "0",
        padding: "5px"
    }
      , B = {
        operate: null,
        isOpen: !1,
        isOnMap: !0,
        isSeries: !0,
        skipEditing: !1,
        isSelectDraw: !1,
        enableCalculate: !1,
        enableSnap: !0,
        snapDistance: 10,
        drawCursor: "crosshair",
        keyCode: 87,
        baseOpts: {
            icon: O,
            node: S,
            nodeT: A,
            fillColor: "#1990FF",
            fillOpacity: .2,
            strokeColor: "#877efb",
            strokeWeight: 3,
            strokeOpacity: 1,
            enableDragging: !0
        },
        labelOptions: P,
        matchOverlay: {
            type: "Circle",
            radius: 2,
            icon: A,
            strokeColor: "#fff",
            strokeStyle: "solid",
            strokeWeight: 2
        },
        centerIcon: new BMapGL.Icon("\n    AAAs1JREFUWAnNmb9v01AQx989SzVI8dIBJNZ27Mb/QRpExMiOKAW1Mw3MRVCB2BlRECF/CBtjuwbBwGJL1JXs474vtuU4Tkho4tyTGr9f\n    fvfxvV93VzL/mfYPLndSumqT4buG6Y4MI3+MpyQayc/IEI/Y0DfLW8Ov725cuKYlf2iZ/p3j8FZylT4hQx1m3lvmXSL6zoYH3pZ9PzgNfi\n    367kKA3R634t/REXF6zMa0Fh28rp8IjJjsqb/det3vUVTXp1z3T8DOs/B+kvIHw3y7/OK180Q/PUuPB2+DL/PGsrMaZQrp3tPwJEn488rh\n    IFQ+GGNDBmTN4qht6D7nm3ESfpRBurNeXGk9Ud/3gkf9N/SnOu6UBvE1jcKBSBQBmXWanAJsH0YvGtNcWV0C6WSX6yQ/McVuQ2DNycFW6d\n    dQkdjz6EF54xQg46MkPMfibYimXozsbn872M2PoGKKcc5tHA7IoiDHkuE7DeKGSOP04rqHcL1Klq8VqMj6dgc3jtMgx+mBFjh8DlhwpSI/\n    BiTaR0FTwn0PHnJWiYnPNcHlLNb4uxYmU16h7Qk26+w5bWQZD9hsZmzqRBRDGJsks4JVMgIwN9M1ArIAykRrRHNMwoY1+EMtoLBhDcID05\n    pGMsWsF1DYLPxWrepzPjWcaq2AYLPw+OFUa4MEE9jG1ox4/NoAEYUAkwNEOAJGohZIsICpAITlinCEFkCw5PEbp0GAIVZixGHZOKRzmoQl\n    SwUgvCjESsSG3eDVJ26nMOQeHRgLQBScP0r0EvmNJJFd9onBIOtxMiH80D4MPzUeXZD4zPAseCjHy8QMTmgQqOiAQI5k+pPoayxlwaMqnO\n    OZJXasSRenOVlfKES0JdM6PGu9qoObC5iDqw1g5oBYtIiVGLK9VRzmbgwZC2NWN0Qus/yc2iTlxmoeIRIXhRBHX5bAXrV9XlmmcH1B9DrB\n    Tf0b4i99lUEMOuku/wAAAABJRU5ErkJggg==",new BMapGL.Size(20,20)),
        circleMoveIcon: new BMapGL.Icon("\n    4c6QAABcdJREFUeAHtm0FoHFUYx7+ZbDfJJiZUqcEgBU3BqtGKRdGLHsSTSGxL8agUT230YtGTDQl6EKt4CD1JqPQkastSPImIvVSUQINR\n    K1jrQVNSRRGz3WST3fH/f5k3THY3mmzejLub74Mv8/bNzJv3fnwz773v+yKiogSUgBJQAkpACSgBJaAElIASUAJKQAkoASWgBJSAElACSk\n    AJKIH2J+A1OsQgCIZw7wh0P3Qwpr0oN7MsoHNzMZ1GOe953pVGOr0pgIB2Kx4yCj0AHW7kgU18zyz6dg46CZjXN9rPDQEEOFrVy9DjUGNh\n    haIEX8+WvEuXy/LbnxX5468AWpHF0kYf/f9c190psrPPl5v7Pdm105cH9nbIQ8PZoKdbLAta6Eno2wDJ8r+KvWndiwDvIE6egg7wooszy/\n    LJhZJ8e6UslQprWl98X+TeoQ556rGsPLpvhx3QPApHAfGsrah3XBcgwPHcCegY1Pv+pxU5nV+Sy1fL9dppm7q9d3TI8yOdcvedGY4pgI5D\n    JwCS5RqpCxDwunHl+9DDlUCCqbOL3vkvmvzdrBna1iqefjwrRw52Bb5nXu0P0dpzgFisbrUGYGh5H+DCw4ViELw5dcOb+aG9ra4aiv2976\n    4OefVIDt9Hj5wI8dlqS8TbXyN8bQ28V94pbFt4pELDIQMaEplAyWaNrAEYThhjfG1peb/Mt8kssWbIm/tBBmRBJrhzLGQUNRIBxAkuTzjb\n    evzmbdfXNiITK5AFmZAN9FTIylwRAcQvrvMGONtutwnDkPiPP2RCNmQEJSsjBiCIcofBRbJZqpgzjv88cn8GC1azNHDW8qEns7L7trgNOG\n    u6bkNcxoVyPGQm9ukv4kQvF8lJrfN6cx5mtG6nEG/p9+X10VxqEMmGjMgKOsqCBfgMf3CHkZQsw/p3ZNxCLOPL3n9TuhBjjOgPEB+mSK/K\n    MPe23J4lJdPfLcvfhcApxM++XJZyOV2IZERWZEZ2tEC6pOSrb0peknvbhRsir00WnEL8ea4ib50upgqRjMiKzCAjBEh/nlxKYbdx9deKc4\n    gXZ1ZShxhb4u0nQDpD5Xe4pNKQdoBI910ogxFA+vPSklaHGGMVBxhRTYVjK0Ok4zgUA9CYnvE32OqUjoSIfaZ5ml3i3D7Al6Jx4TfRLni5\n    xJk4lpPObOPt1bszxipgb6/xIrq50xa40eG87Ioem/+8JFt1YAzu8uXAE6vEuE6cOrcoS46XtzFW10iNESoTI4hGkkKB8CaO9cie3R3maR\n    99uiRnzkdbpYZ6QHhvvJTDWHwhvHfPFOXCtNm/NtTeejcxnhLKXASQAZa0pJXhkVGMlQHIuKjQ+5qGtDo8MmIkL5Rpml2ePx6+LxswOpWk\n    tAM8MmIYNOSU9+HjZ0R+FoPzGNpLSjJo2vU3r6/XS+WbF2dCRmRFZmRnbY4ReRMXjV/ssvzgPRmnEwb7xshZ0hNGNQPGjkMxzCzASVQuMK\n    jMuGgS0tezOnO5mG1t/xAtS3S2tc+xR7IJA+/MWCCzVX8gTJG5IExnMEFlHl0L41ou4bF/SS5V6o2fAfdQTobMonwQgW+LXtYfoQPvfbzo\n    PC6SgTd/xfGSLIssjJJxENtxJXfk5+KFQ2bRP4+n7AFAWmHkkZaw4ijqAkbkXS9rXMNj59OCRxZkQjZQ5ssYeOyD/QayTIhMpBlnOgMj8l\n    vdl5pGW/wPGZBFmOIxHjKKRhXtSWwNXmXWaWoHIGwktaMGIEECInaqmlzUUHIRAVJCSzyB4hhU09s2k95GgFYAUhMsLYw6x7qvcPV1gMgl\n    Tk2KL6NTDEYxntIqKb5d2Ehw92JTfPmdox8g3J5x6JxhuSZ2k+LLFq0AJFNAmMXAQPywrW+T4yzGkUySeT1AgDmEesaUGRZlZM8qrbWZhR\n    ZGJ7LVLf2bQzMPVPumBJSAElACSkAJKAEloASUgBJQAkpACSgBJaAElIASUAJKQAkoAVcE/gG4Wba8Vno8+QAAAABJRU5ErkJggg==",new BMapGL.Size(40,20),{
            imageOffset: new BMapGL.Size(0,10)
        }),
        moveIcon: new BMapGL.Icon(M,new BMapGL.Size(10,10)),
        limitPoint: -1
    }
      , G = {
        tips: "测距",
        unit: "kilometers",
        startLabel: "单击确定起点",
        followLabel: "单击确定地点，双击结束测量",
        skipEditing: !0,
        enableCalculate: !0,
        turnIcon: null,
        closeIcon: null,
        isSeries: !1,
        baseOpts: {
            strokeColor: "#f00",
            strokeWeight: 2,
            strokeOpacity: .8,
            fillOpacity: .2
        },
        labelOptions: P
    }
      , C = {
        unit: "kilometers",
        startLabel: "单击确定起点",
        followLabel: "单击确定地点，双击结束测量",
        turnIcon: null,
        closeIcon: null,
        isSeries: !1,
        baseOpts: {
            strokeColor: "#f00",
            strokeWeight: 2,
            strokeOpacity: 1
        },
        labelOptions: P
    }
      , I = {
        icon: A,
        nodeT: null,
        node: null,
        fillColor: "#fff",
        fillOpacity: .1,
        strokeColor: "#00f",
        strokeWeight: 2,
        strokeOpacity: .6,
        strokeStyle: "dashed"
    }
      , R = {
        strokeColor: "#fff",
        strokeStyle: "solid",
        strokeWeight: "2"
    }
      , N = ["marker", "polyline", "polygon", "circle", "rectangle"]
      , D = {
        grid: "$BAIDU$",
        guid: function() {
            return window[D.grid] || (window[D.grid] = {}),
            window[D.grid]._counter = window[D.grid]._counter || 1,
            window[D.grid]._instances = window[D.grid]._instances || {},
            "TANGRAM__" + (window[D.grid]._counter++).toString(36)
        },
        isString: function(e) {
            return "[object String]" === Object.prototype.toString.call(e)
        },
        isFunction: function(e) {
            return "[object Function]" === Object.prototype.toString.call(e)
        },
        isArray: function(e) {
            return Array.isArray ? Array.isArray(e) : "[object Array]" === Object.prototype.toString.call(e)
        },
        isObject: function(e) {
            return "[object Object]" === Object.prototype.toString.call(e)
        },
        copyOptionsToNew: function(e, t, n) {
            for (var i in t)
                if (e.hasOwnProperty(i)) {
                    if (!t[i] || t[i]instanceof Array || t[i]instanceof BMapGL.Icon || t[i]instanceof BMapGL.Symbol || t[i].ignore) {
                        n[i] = t[i];
                        continue
                    }
                    if (null !== t[i] && "object" === g(t[i]) && 0 === Object.keys(t[i]).length)
                        continue;
                    null !== t[i] && "object" === g(t[i]) && Object.keys(t[i]).length > 0 ? (n[i] = {},
                    this.copyOptionsToNew(e[i], t[i], n[i])) : n[i] = t[i]
                }
        },
        copyNotExitOptions: function(e, t) {
            var n = this
              , i = function(i) {
                if (e.hasOwnProperty(i))
                    -1 !== ["baseOpts", "labelOptions", "matchOverlay"].findIndex((function(e) {
                        return i === e
                    }
                    )) && n.copyNotExitOptions(e[i], t[i]);
                else {
                    if (!t[i] || t[i]instanceof Array || t[i]instanceof BMapGL.Icon || t[i]instanceof BMapGL.Symbol || t[i].ignore)
                        return e[i] = t[i],
                        1;
                    null !== t[i] && "object" === g(t[i]) ? (e[i] = {},
                    n.copyNotExitOptions(e[i], t[i])) : e[i] = t[i]
                }
            };
            for (var r in t)
                i(r)
        },
        copyOptions: function(e, t) {
            var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [];
            for (var i in t)
                if (e && e.hasOwnProperty(i)) {
                    if (t[i]instanceof Array || t[i]instanceof BMapGL.Icon || t[i]instanceof BMapGL.Symbol || this.shotObject(t[i], n)) {
                        e[i] = t[i];
                        continue
                    }
                    null !== t[i] && "object" === g(t[i]) ? this.copyOptions(e[i], t[i], n) : e[i] = t[i]
                }
        },
        shotObject: function(e, t) {
            var n = !1;
            return t.forEach((function(t) {
                if (e instanceof t)
                    return n = !0,
                    !0
            }
            )),
            n
        },
        deepCopy: function(e) {
            var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2
              , n = arguments.length > 2 ? arguments[2] : void 0
              , i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0
              , r = arguments.length > 4 ? arguments[4] : void 0;
            for (var o in n ? i++ : (n = {},
            i = 1),
            e)
                e[o]instanceof Array || e[o]instanceof BMapGL.Icon || e[o]instanceof BMapGL.Symbol || this.shotObject(e[o], r) ? n[o] = e[o] : t >= i && D.isObject(e[o]) && Object.keys(e[o]).length > 0 ? (n[o] = {},
                this.deepCopy(e[o], t, n[o], i, r)) : n[o] = e[o]
        },
        getTarget: function(e) {
            var t = window.event || e;
            return t.target || t.srcElement
        },
        getEvent: function(e) {
            return window.event || e
        },
        preventDefault: function(e) {
            var t = D.getEvent(e);
            t.preventDefault ? t.preventDefault() : t.returnValue = !1
        },
        stopBubble: function(e) {
            var t = D.getEvent(e);
            t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0
        },
        on: function(e, t, n, i) {
            t = t.replace(/^on/i, ""),
            e = D.getdom(e);
            var r = n
              , o = t;
            return t = t.toLowerCase(),
            e.addEventListener ? e.addEventListener(o, r, !1) : e.attachEvent && e.attachEvent("on" + o, r),
            e
        },
        un: function(e, t, n, i) {
            e = D.getdom(e);
            for (var r, o, s, a = i.length, l = !n; a--; )
                (r = i[a])[1] !== t || r[0] !== e || !l && r[2] !== n || (o = r[4],
                s = r[3],
                e.removeEventListener ? e.removeEventListener(o, s, !1) : e.detachEvent && e.detachEvent("on" + o, s),
                i.splice(a, 1));
            return e
        },
        getdom: function(e) {
            return D.isString(e) ? document.getElementById(e) : e
        },
        addClass: function(e, t) {
            e = D.getdom(e);
            for (var n = t.split(/\s+/), i = e.className, r = " " + i + " ", o = n.length, s = 0; o > s; s++)
                0 > r.indexOf(" " + n[s] + " ") && (i += (i ? " " : "") + n[s]);
            return e.className = i,
            e
        },
        mc2ll: function(e, t) {
            var n = t.mercatorToLnglat(e.lng, e.lat);
            return new BMapGL.Point(n[0],n[1])
        },
        ll2mc: function(e, t) {
            var n = t.lnglatToMercator(e.lng, e.lat);
            return new BMapGL.Point(n[0],n[1])
        },
        getPointByDistance: function(e, t, n) {
            var i, r, o, s = t / 6378800, a = Math.PI / 180 * e.lat, l = Math.PI / 180 * e.lng;
            switch (n) {
            case "North":
            case "north":
            case "N":
            case "n":
                i = 0,
                r = e.lng;
                break;
            case "West":
            case "west":
            case "W":
            case "w":
                i = 90,
                o = e.lat;
                break;
            case "South":
            case "south":
            case "S":
            case "s":
                i = 180,
                r = e.lng;
                break;
            case "East":
            case "east":
            case "E":
            case "e":
                i = 270,
                o = e.lat;
                break;
            default:
                i = ~~n
            }
            var h = Math.PI / 180 * i
              , c = Math.asin(Math.sin(a) * Math.cos(s) + Math.cos(a) * Math.sin(s) * Math.cos(h))
              , u = new BMapGL.Point(r || ((l - Math.atan2(Math.sin(h) * Math.sin(s) * Math.cos(a), Math.cos(s) - Math.sin(a) * Math.sin(c)) + Math.PI) % (2 * Math.PI) - Math.PI) * (180 / Math.PI),o || c * (180 / Math.PI));
            return u.lng = parseFloat(u.lng.toFixed(6)),
            u.lat = parseFloat(u.lat.toFixed(6)),
            u
        },
        throttle: function(e, t, n) {
            if ("function" != typeof e)
                return Function();
            var i = null
              , r = null;
            return function(o) {
                var s = o
                  , a = +new Date;
                !r && (r = a),
                n && a - r > n ? (e(s),
                r = a) : (clearTimeout(i),
                i = setTimeout((function() {
                    e(s),
                    r = null
                }
                ), t))
            }
        }
    }
      , _ = function(e) {
        for (var t = arguments.length, r = Array(t > 1 ? t - 1 : 0), s = 1; t > s; s++)
            r[s - 1] = arguments[s];
        var a = function(e) {
            function t() {
                var e;
                i(this, t);
                for (var o = arguments.length, s = Array(o), a = 0; o > a; a++)
                    s[a] = arguments[a];
                return e = n(this, t, [].concat(s)),
                r.forEach((function(t) {
                    l(e, new t)
                }
                )),
                e
            }
            return h(t, e),
            o(t)
        }(e)
          , l = function(e, t) {
            Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach((function(n) {
                n.match(/^(?:constructor|prototype|arguments|caller|name|bind|call|apply|toString|length)$/) || Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n))
            }
            ))
        };
        return r.forEach((function(e) {
            l(a.prototype, e.prototype),
            l(a, e)
        }
        )),
        a
    }
      , T = o((function e(t, n) {
        i(this, e),
        this.type = t,
        this.returnValue = !0,
        this.target = n || null,
        this.currentTarget = null
    }
    ))
      , F = function() {
        return o((function e() {
            i(this, e),
            this._listeners = {}
        }
        ), [{
            key: "addEventListener",
            value: function(e, t, n) {
                if (D.isFunction(t)) {
                    !this._listeners && (this._listeners = {});
                    var i, r = this._listeners;
                    if ("string" == typeof n && n) {
                        if (/[^\w\-]/.test(n))
                            throw "nonstandard key:" + n;
                        t.hashCode = n,
                        i = n
                    }
                    0 !== e.indexOf("on") && (e = "on" + e),
                    "object" !== g(r[e]) && (r[e] = {}),
                    i = i || D.guid(),
                    t.hashCode = i,
                    r[e][i] = t
                }
            }
        }, {
            key: "removeEventListener",
            value: function(e, t) {
                if (D.isFunction(t))
                    t = t.hashCode;
                else if (!D.isString(t))
                    return;
                !this._listeners && (this._listeners = {}),
                0 !== e.indexOf("on") && (e = "on" + e);
                var n = this._listeners;
                n[e] && n[e][t] && delete n[e][t]
            }
        }, {
            key: "dispatchEvent",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
                for (var n in !this._listeners && (this._listeners = {}),
                D.isString(e) && (e = new T(e)),
                t)
                    e[n] = t[n];
                var i = this._listeners
                  , r = e.type;
                if (0 !== r.indexOf("on") && (r = "on" + r),
                D.isFunction(this[r]) && this[r].apply(this, arguments),
                "object" === g(i[r]))
                    for (var o in i[r])
                        i[r][o].apply(this, arguments);
                return e.returnValue
            }
        }, {
            key: "dispose",
            value: function() {
                for (var e in this._listeners)
                    for (var t in this._listeners[e])
                        delete this._listeners[e][t]
            }
        }, {
            key: "defineProperty",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2
                  , n = arguments.length > 2 ? arguments[2] : void 0
                  , i = arguments.length > 3 ? arguments[3] : void 0;
                for (var r in void 0 === n ? (n = this,
                i = 1) : i++,
                e)
                    n && n.hasOwnProperty(r) && (e[r]instanceof Array || e[r]instanceof BMapGL.Icon || e[r]instanceof BMapGL.Symbol ? n[r] = e[r] : t > i && D.isObject(e[r]) && Object.keys(e[r]).length > 0 ? this.defineProperty(e[r], t, n[r], i) : n[r] = e[r])
            }
        }, {
            key: "setSnapPointType",
            value: function(e) {
                var t, n;
                "Marker" === (null === (t = e.matchOverlay) || void 0 === t ? void 0 : t.type) ? this.matchOverlay = new BMapGL.Marker(new BMapGL.Point(116.395,39.935),e.matchOverlay) : "Circle" === (null === (n = e.matchOverlay) || void 0 === n ? void 0 : n.type) ? (!e.matchOverlay.radius || (this.matchOverlayRadius = e.matchOverlay.radius),
                this.matchOverlay = new BMapGL.Circle(new BMapGL.Point(116.395,39.935),this.matchOverlayRadius,e.matchOverlay)) : this.matchOverlay = new BMapGL.Circle(new BMapGL.Point(116.395,39.935),this.matchOverlayRadius,R)
            }
        }, {
            key: "setSceneStatus",
            value: function(e) {
                this.scene.currentStatus = e;
                // switch(e) {
                //     case 'editer':
                //         this.scene.mask.show();
                //         break;
                //     case 'free':
                //         this.scene.mask.hide();
                //         break;
                // }
                // console.log('------ setSceneStatus', e)
            }
        }])
    }()
      , W = function(e) {
        function t(e) {
            var r;
            return i(this, t),
            (r = n(this, t)).delayLimit = 100,
            r.minLimit = 200,
            r.overlayData = [],
            r.click = void 0,
            r.mousemove = void 0,
            r.rightclick = void 0,
            r.map = e,
            r.open(),
            r
        }
        return h(t, e),
        o(t, [{
            key: "open",
            value: function() {
                this.openClick(),
                this.openMouse(),
                this.openRightClick()
            }
        }, {
            key: "linkOverlayData",
            value: function(e) {
                this.overlayData = e
            }
        }, {
            key: "clickAction",
            value: function(e) {
                this.dispatchEvent(new T(b.CLICK,e))
            }
        }, {
            key: "rightclickAction",
            value: function(e) {
                this.dispatchEvent(new T(b.RIGHTCLICK,e))
            }
        }, {
            key: "mouseAction",
            value: function(e) {
                e && this.dispatchEvent(new T(b.MOVE,e))
            }
        }, {
            key: "openClick",
            value: function() {
                this.click || this.map.addEventListener("click", this.click = this.clickAction.bind(this))
            }
        }, {
            key: "openRightClick",
            value: function() {
                this.rightclick || this.map.addEventListener("rightclick", this.rightclick = this.rightclickAction.bind(this))
            }
        }, {
            key: "openMouse",
            value: function() {
                this.mousemove || (this.mousemove = D.throttle(this.mouseAction.bind(this), this.delayLimit, this.minLimit).bind(this),
                this.map.addEventListener("mousemove", this.mousemove))
            }
        }, {
            key: "close",
            value: function() {
                this.closeClick(),
                this.closeMouse()
            }
        }, {
            key: "closeClick",
            value: function() {
                this.click && (this.map.removeEventListener("click", this.click),
                this.click = null)
            }
        }, {
            key: "closeMouse",
            value: function() {
                this.mousemove && (this.map.removeEventListener("mousemove", this.mousemove),
                this.mousemove = null)
            }
        }, {
            key: "intersectOverlays",
            value: function(e) {
                for (var t = [], n = 0; this.overlayData.length > n; n++) {
                    var i = this.overlayData[n];
                    if ("" + i != "Marker") {
                        var r = ("" + i != "Polyline" ? i._getInPnpoly(e.point) : i._getProximity(e.point)).dist;
                        r >= 0 && i._config.mouseOverTolerance > r && t.push(i)
                    } else
                        i._getInPnBox(e.pixel) && t.push(i)
                }
                return t.length > 0 ? t : null
            }
        }])
    }(F)
      , z = 6371008.8
      , j = {
        centimeters: 100 * z,
        centimetres: 100 * z,
        degrees: z / 111325,
        feet: 3.28084 * z,
        inches: 39.37 * z,
        kilometers: z / 1e3,
        kilometres: z / 1e3,
        meters: z,
        metres: z,
        miles: z / 1609.344,
        millimeters: 1e3 * z,
        millimetres: 1e3 * z,
        nauticalmiles: z / 1852,
        radians: 1,
        yards: 1.0936 * z
    }
      , U = {
        acres: 247105e-9,
        centimeters: 1e4,
        centimetres: 1e4,
        feet: 10.763910417,
        hectares: 1e-4,
        inches: 1550.003100006,
        kilometers: 1e-6,
        kilometres: 1e-6,
        meters: 1,
        metres: 1,
        miles: 386e-9,
        millimeters: 1e6,
        millimetres: 1e6,
        yards: 1.195990046
    };
    function Y(e, t, n) {
        void 0 === n && (n = {});
        var i = {
            type: "Feature"
        };
        return (0 === n.id || n.id) && (i.id = n.id),
        n.bbox && (i.bbox = n.bbox),
        i.properties = t || {},
        i.geometry = e,
        i
    }
    function J(e, t, n) {
        if (void 0 === n && (n = {}),
        !e)
            throw Error("coordinates is required");
        if (!Array.isArray(e))
            throw Error("coordinates must be an Array");
        if (2 > e.length)
            throw Error("coordinates must be at least 2 numbers long");
        if (!re(e[0]) || !re(e[1]))
            throw Error("coordinates must contain numbers");
        return Y({
            type: "Point",
            coordinates: e
        }, t, n)
    }
    function X(e, t, n) {
        void 0 === n && (n = {});
        for (var i = 0, r = e; r.length > i; i++) {
            var o = r[i];
            if (4 > o.length)
                throw Error("Each LinearRing of a Polygon must have 4 or more Positions.");
            for (var s = 0; o[o.length - 1].length > s; s++)
                if (o[o.length - 1][s] !== o[0][s])
                    throw Error("First and last Position are not equivalent.")
        }
        return Y({
            type: "Polygon",
            coordinates: e
        }, t, n)
    }
    function V(e, t, n) {
        if (void 0 === n && (n = {}),
        2 > e.length)
            throw Error("coordinates must be an array of two or more positions");
        return Y({
            type: "LineString",
            coordinates: e
        }, t, n)
    }
    function Q(e, t) {
        void 0 === t && (t = {});
        var n = {
            type: "FeatureCollection"
        };
        return t.id && (n.id = t.id),
        t.bbox && (n.bbox = t.bbox),
        n.features = e,
        n
    }
    function H(e, t, n) {
        return void 0 === n && (n = {}),
        Y({
            type: "MultiLineString",
            coordinates: e
        }, t, n)
    }
    function K(e, t, n) {
        return void 0 === n && (n = {}),
        Y({
            type: "MultiPoint",
            coordinates: e
        }, t, n)
    }
    function Z(e, t, n) {
        return void 0 === n && (n = {}),
        Y({
            type: "MultiPolygon",
            coordinates: e
        }, t, n)
    }
    function q(e, t) {
        void 0 === t && (t = "kilometers");
        var n = j[t];
        if (!n)
            throw Error(t + " units is invalid");
        return e * n
    }
    function $(e, t) {
        void 0 === t && (t = "kilometers");
        var n = j[t];
        if (!n)
            throw Error(t + " units is invalid");
        return e / n
    }
    function ee(e, t) {
        return te($(e, t))
    }
    function te(e) {
        return 180 * (e % (2 * Math.PI)) / Math.PI
    }
    function ne(e) {
        return e % 360 * Math.PI / 180
    }
    function ie(e, t, n) {
        if (void 0 === t && (t = "kilometers"),
        void 0 === n && (n = "kilometers"),
        e < 0)
            throw Error("length must be a positive number");
        return q($(e, t), n)
    }
    function re(e) {
        return !isNaN(e) && null !== e && !Array.isArray(e)
    }
    function oe(e) {
        return !!e && e.constructor === Object
    }
    var se = Object.freeze({
        __proto__: null,
        earthRadius: z,
        factors: j,
        unitsFactors: {
            centimeters: 100,
            centimetres: 100,
            degrees: 1 / 111325,
            feet: 3.28084,
            inches: 39.37,
            kilometers: .001,
            kilometres: .001,
            meters: 1,
            metres: 1,
            miles: 1 / 1609.344,
            millimeters: 1e3,
            millimetres: 1e3,
            nauticalmiles: 1 / 1852,
            radians: 1 / z,
            yards: 1.0936133
        },
        areaFactors: U,
        feature: Y,
        geometry: function(e, t, n) {
            switch (e) {
            case "Point":
                return J(t).geometry;
            case "LineString":
                return V(t).geometry;
            case "Polygon":
                return X(t).geometry;
            case "MultiPoint":
                return K(t).geometry;
            case "MultiLineString":
                return H(t).geometry;
            case "MultiPolygon":
                return Z(t).geometry;
            default:
                throw Error(e + " is invalid")
            }
        },
        point: J,
        points: function(e, t, n) {
            return void 0 === n && (n = {}),
            Q(e.map((function(e) {
                return J(e, t)
            }
            )), n)
        },
        polygon: X,
        polygons: function(e, t, n) {
            return void 0 === n && (n = {}),
            Q(e.map((function(e) {
                return X(e, t)
            }
            )), n)
        },
        lineString: V,
        lineStrings: function(e, t, n) {
            return void 0 === n && (n = {}),
            Q(e.map((function(e) {
                return V(e, t)
            }
            )), n)
        },
        featureCollection: Q,
        multiLineString: H,
        multiPoint: K,
        multiPolygon: Z,
        geometryCollection: function(e, t, n) {
            return void 0 === n && (n = {}),
            Y({
                type: "GeometryCollection",
                geometries: e
            }, t, n)
        },
        round: function(e, t) {
            if (void 0 === t && (t = 0),
            t && t < 0)
                throw Error("precision must be a positive number");
            var n = Math.pow(10, t || 0);
            return Math.round(e * n) / n
        },
        radiansToLength: q,
        lengthToRadians: $,
        lengthToDegrees: ee,
        bearingToAzimuth: function(e) {
            var t = e % 360;
            return 0 > t && (t += 360),
            t
        },
        radiansToDegrees: te,
        degreesToRadians: ne,
        convertLength: ie,
        convertArea: function(e, t, n) {
            if (void 0 === t && (t = "meters"),
            void 0 === n && (n = "kilometers"),
            e < 0)
                throw Error("area must be a positive number");
            var i = U[t];
            if (!i)
                throw Error("invalid original units");
            var r = U[n];
            if (!r)
                throw Error("invalid final units");
            return e / i * r
        },
        isNumber: re,
        isObject: oe,
        validateBBox: function(e) {
            if (!e)
                throw Error("bbox is required");
            if (!Array.isArray(e))
                throw Error("bbox must be an Array");
            if (4 !== e.length && 6 !== e.length)
                throw Error("bbox must be an Array of 4 or 6 numbers");
            e.forEach((function(e) {
                if (!re(e))
                    throw Error("bbox must only contain numbers")
            }
            ))
        },
        validateId: function(e) {
            if (!e)
                throw Error("id is required");
            if (-1 === ["string", "number"].indexOf(typeof e))
                throw Error("id must be a number or a string")
        }
    });
    function ae(e, t, n) {
        if (null !== e)
            for (var i, r, o, s, a, l, h, c, u = 0, p = 0, v = e.type, d = "FeatureCollection" === v, f = "Feature" === v, g = d ? e.features.length : 1, m = 0; g > m; m++) {
                a = (c = !!(h = d ? e.features[m].geometry : f ? e.geometry : e) && "GeometryCollection" === h.type) ? h.geometries.length : 1;
                for (var y = 0; a > y; y++) {
                    var b = 0
                      , w = 0;
                    if (null !== (s = c ? h.geometries[y] : h)) {
                        l = s.coordinates;
                        var E = s.type;
                        switch (u = !n || "Polygon" !== E && "MultiPolygon" !== E ? 0 : 1,
                        E) {
                        case null:
                            break;
                        case "Point":
                            if (!1 === t(l, p, m, b, w))
                                return !1;
                            p++,
                            b++;
                            break;
                        case "LineString":
                        case "MultiPoint":
                            for (i = 0; l.length > i; i++) {
                                if (!1 === t(l[i], p, m, b, w))
                                    return !1;
                                p++,
                                "MultiPoint" === E && b++
                            }
                            "LineString" === E && b++;
                            break;
                        case "Polygon":
                        case "MultiLineString":
                            for (i = 0; l.length > i; i++) {
                                for (r = 0; l[i].length - u > r; r++) {
                                    if (!1 === t(l[i][r], p, m, b, w))
                                        return !1;
                                    p++
                                }
                                "MultiLineString" === E && b++,
                                "Polygon" === E && w++
                            }
                            "Polygon" === E && b++;
                            break;
                        case "MultiPolygon":
                            for (i = 0; l.length > i; i++) {
                                for (w = 0,
                                r = 0; l[i].length > r; r++) {
                                    for (o = 0; l[i][r].length - u > o; o++) {
                                        if (!1 === t(l[i][r][o], p, m, b, w))
                                            return !1;
                                        p++
                                    }
                                    w++
                                }
                                b++
                            }
                            break;
                        case "GeometryCollection":
                            for (i = 0; s.geometries.length > i; i++)
                                if (!1 === ae(s.geometries[i], t, n))
                                    return !1;
                            break;
                        default:
                            throw Error("Unknown Geometry Type")
                        }
                    }
                }
            }
    }
    function le(e, t) {
        var n;
        switch (e.type) {
        case "FeatureCollection":
            for (n = 0; e.features.length > n && !1 !== t(e.features[n].properties, n); n++)
                ;
            break;
        case "Feature":
            t(e.properties, 0)
        }
    }
    function he(e, t) {
        if ("Feature" === e.type)
            t(e, 0);
        else if ("FeatureCollection" === e.type)
            for (var n = 0; e.features.length > n && !1 !== t(e.features[n], n); n++)
                ;
    }
    function ce(e, t, n) {
        var i = n;
        return he(e, (function(e, r) {
            i = 0 === r && void 0 === n ? e : t(i, e, r)
        }
        )),
        i
    }
    function ue(e, t) {
        var n, i, r, o, s, a, l, h, c, u, p = 0, v = "FeatureCollection" === e.type, d = "Feature" === e.type, f = v ? e.features.length : 1;
        for (n = 0; f > n; n++) {
            for (h = v ? e.features[n].properties : d ? e.properties : {},
            c = v ? e.features[n].bbox : d ? e.bbox : void 0,
            u = v ? e.features[n].id : d ? e.id : void 0,
            s = (l = !!(a = v ? e.features[n].geometry : d ? e.geometry : e) && "GeometryCollection" === a.type) ? a.geometries.length : 1,
            r = 0; s > r; r++)
                if (null !== (o = l ? a.geometries[r] : a))
                    switch (o.type) {
                    case "Point":
                    case "LineString":
                    case "MultiPoint":
                    case "Polygon":
                    case "MultiLineString":
                    case "MultiPolygon":
                        if (!1 === t(o, p, h, c, u))
                            return !1;
                        break;
                    case "GeometryCollection":
                        for (i = 0; o.geometries.length > i; i++)
                            if (!1 === t(o.geometries[i], p, h, c, u))
                                return !1;
                        break;
                    default:
                        throw Error("Unknown Geometry Type")
                    }
                else if (!1 === t(null, p, h, c, u))
                    return !1;
            p++
        }
    }
    function pe(e, t, n) {
        var i = n;
        return ue(e, (function(e, r, o, s, a) {
            i = 0 === r && void 0 === n ? e : t(i, e, r, o, s, a)
        }
        )),
        i
    }
    function ve(e, t) {
        ue(e, (function(e, n, i, r, o) {
            var s, a = null === e ? null : e.type;
            switch (a) {
            case null:
            case "Point":
            case "LineString":
            case "Polygon":
                return !1 !== t(Y(e, i, {
                    bbox: r,
                    id: o
                }), n, 0) && void 0
            }
            switch (a) {
            case "MultiPoint":
                s = "Point";
                break;
            case "MultiLineString":
                s = "LineString";
                break;
            case "MultiPolygon":
                s = "Polygon"
            }
            for (var l = 0; e.coordinates.length > l; l++) {
                if (!1 === t(Y({
                    type: s,
                    coordinates: e.coordinates[l]
                }, i), n, l))
                    return !1
            }
        }
        ))
    }
    function de(e, t) {
        ve(e, (function(e, n, i) {
            var r = 0;
            if (e.geometry) {
                var o = e.geometry.type;
                if ("Point" !== o && "MultiPoint" !== o) {
                    var s, a = 0, l = 0, h = 0;
                    return !1 !== ae(e, (function(o, c, u, p, v) {
                        if (void 0 === s || n > a || p > l || v > h)
                            return s = o,
                            a = n,
                            l = p,
                            h = v,
                            void (r = 0);
                        var d = V([s, o], e.properties);
                        if (!1 === t(d, n, i, v, r))
                            return !1;
                        r++,
                        s = o
                    }
                    )) && void 0
                }
            }
        }
        ))
    }
    function fe(e, t, n) {
        var i = n
          , r = !1;
        return de(e, (function(e, o, s, a, l) {
            i = !1 === r && void 0 === n ? e : t(i, e, o, s, a, l),
            r = !0
        }
        )),
        i
    }
    function ge(e, t) {
        if (!e)
            throw Error("geojson is required");
        ve(e, (function(e, n, i) {
            if (null !== e.geometry) {
                var r = e.geometry.coordinates;
                switch (e.geometry.type) {
                case "LineString":
                    if (!1 === t(e, n, i, 0, 0))
                        return !1;
                    break;
                case "Polygon":
                    for (var o = 0; r.length > o; o++)
                        if (!1 === t(V(r[o], e.properties), n, i, o))
                            return !1
                }
            }
        }
        ))
    }
    var me = Object.freeze({
        __proto__: null,
        coordAll: function(e) {
            var t = [];
            return ae(e, (function(e) {
                t.push(e)
            }
            )),
            t
        },
        coordEach: ae,
        coordReduce: function(e, t, n, i) {
            var r = n;
            return ae(e, (function(e, i, o, s, a) {
                r = 0 === i && void 0 === n ? e : t(r, e, i, o, s, a)
            }
            ), i),
            r
        },
        featureEach: he,
        featureReduce: ce,
        findPoint: function(e, t) {
            if (!oe(t = t || {}))
                throw Error("options is invalid");
            var n, i = t.featureIndex || 0, r = t.multiFeatureIndex || 0, o = t.geometryIndex || 0, s = t.coordIndex || 0, a = t.properties;
            switch (e.type) {
            case "FeatureCollection":
                0 > i && (i = e.features.length + i),
                a = a || e.features[i].properties,
                n = e.features[i].geometry;
                break;
            case "Feature":
                a = a || e.properties,
                n = e.geometry;
                break;
            case "Point":
            case "MultiPoint":
                return null;
            case "LineString":
            case "Polygon":
            case "MultiLineString":
            case "MultiPolygon":
                n = e;
                break;
            default:
                throw Error("geojson is invalid")
            }
            if (null === n)
                return null;
            var l = n.coordinates;
            switch (n.type) {
            case "Point":
                return J(l, a, t);
            case "MultiPoint":
                return 0 > r && (r = l.length + r),
                J(l[r], a, t);
            case "LineString":
                return 0 > s && (s = l.length + s),
                J(l[s], a, t);
            case "Polygon":
                return 0 > o && (o = l.length + o),
                0 > s && (s = l[o].length + s),
                J(l[o][s], a, t);
            case "MultiLineString":
                return 0 > r && (r = l.length + r),
                0 > s && (s = l[r].length + s),
                J(l[r][s], a, t);
            case "MultiPolygon":
                return 0 > r && (r = l.length + r),
                0 > o && (o = l[r].length + o),
                0 > s && (s = l[r][o].length - s),
                J(l[r][o][s], a, t)
            }
            throw Error("geojson is invalid")
        },
        findSegment: function(e, t) {
            if (!oe(t = t || {}))
                throw Error("options is invalid");
            var n, i = t.featureIndex || 0, r = t.multiFeatureIndex || 0, o = t.geometryIndex || 0, s = t.segmentIndex || 0, a = t.properties;
            switch (e.type) {
            case "FeatureCollection":
                0 > i && (i = e.features.length + i),
                a = a || e.features[i].properties,
                n = e.features[i].geometry;
                break;
            case "Feature":
                a = a || e.properties,
                n = e.geometry;
                break;
            case "Point":
            case "MultiPoint":
                return null;
            case "LineString":
            case "Polygon":
            case "MultiLineString":
            case "MultiPolygon":
                n = e;
                break;
            default:
                throw Error("geojson is invalid")
            }
            if (null === n)
                return null;
            var l = n.coordinates;
            switch (n.type) {
            case "Point":
            case "MultiPoint":
                return null;
            case "LineString":
                return 0 > s && (s = l.length + s - 1),
                V([l[s], l[s + 1]], a, t);
            case "Polygon":
                return 0 > o && (o = l.length + o),
                0 > s && (s = l[o].length + s - 1),
                V([l[o][s], l[o][s + 1]], a, t);
            case "MultiLineString":
                return 0 > r && (r = l.length + r),
                0 > s && (s = l[r].length + s - 1),
                V([l[r][s], l[r][s + 1]], a, t);
            case "MultiPolygon":
                return 0 > r && (r = l.length + r),
                0 > o && (o = l[r].length + o),
                0 > s && (s = l[r][o].length - s - 1),
                V([l[r][o][s], l[r][o][s + 1]], a, t)
            }
            throw Error("geojson is invalid")
        },
        flattenEach: ve,
        flattenReduce: function(e, t, n) {
            var i = n;
            return ve(e, (function(e, r, o) {
                i = 0 === r && 0 === o && void 0 === n ? e : t(i, e, r, o)
            }
            )),
            i
        },
        geomEach: ue,
        geomReduce: pe,
        lineEach: ge,
        lineReduce: function(e, t, n) {
            var i = n;
            return ge(e, (function(e, r, o, s) {
                i = 0 === r && void 0 === n ? e : t(i, e, r, o, s)
            }
            )),
            i
        },
        propEach: le,
        propReduce: function(e, t, n) {
            var i = n;
            return le(e, (function(e, r) {
                i = 0 === r && void 0 === n ? e : t(i, e, r)
            }
            )),
            i
        },
        segmentEach: de,
        segmentReduce: fe
    });
    function ye(e) {
        var t = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
        return ae(e, (function(e) {
            t[0] > e[0] && (t[0] = e[0]),
            t[1] > e[1] && (t[1] = e[1]),
            e[0] > t[2] && (t[2] = e[0]),
            e[1] > t[3] && (t[3] = e[1])
        }
        )),
        t
    }
    ye.default = ye;
    var be = Object.freeze({
        __proto__: null,
        default: ye
    });
    function we(e) {
        if (!e)
            throw Error("coord is required");
        if (!Array.isArray(e)) {
            if ("Feature" === e.type && null !== e.geometry && "Point" === e.geometry.type)
                return e.geometry.coordinates;
            if ("Point" === e.type)
                return e.coordinates
            if (!e.type && ('lat' in e) && ('lng' in e)) {
                return [e.lng, e.lat]
            }
        }
        if (Array.isArray(e) && e.length >= 2 && !Array.isArray(e[0]) && !Array.isArray(e[1]))
            return e;
        throw Error("coord must be GeoJSON Point or an Array of numbers")
    }
    function Ee(e) {
        if (Array.isArray(e))
            return e;
        if ("Feature" === e.type) {
            if (null !== e.geometry)
                return e.geometry.coordinates
        } else if (e.coordinates)
            return e.coordinates;
        throw Error("coords must be GeoJSON Feature, Geometry Object or an Array")
    }
    function ke(e, t, n) {
        if (!e)
            throw Error("No feature passed");
        if (!n)
            throw Error(".featureOf() requires a name");
        if (!e || "Feature" !== e.type || !e.geometry)
            throw Error("Invalid input to " + n + ", Feature with geometry required");
        if (!e.geometry || e.geometry.type !== t)
            throw Error("Invalid input to " + n + ": must be a " + t + ", given " + e.geometry.type)
    }
    function Me(e) {
        return "Feature" === e.type ? e.geometry : e
    }
    function Le(e, t) {
        return "FeatureCollection" === e.type ? "FeatureCollection" : "GeometryCollection" === e.type ? "GeometryCollection" : "Feature" === e.type && null !== e.geometry ? e.geometry.type : e.type
    }
    function xe(e) {
        if (e.__esModule)
            return e;
        var t = Object.defineProperty({}, "__esModule", {
            value: !0
        });
        return Object.keys(e).forEach((function(n) {
            var i = Object.getOwnPropertyDescriptor(e, n);
            Object.defineProperty(t, n, i.get ? i : {
                enumerable: !0,
                get: function() {
                    return e[n]
                }
            })
        }
        )),
        t
    }
    function Oe(e, t, n) {
        if (void 0 === n && (n = {}),
        !e)
            throw Error("point is required");
        if (!t)
            throw Error("polygon is required");
        var i = we(e)
          , r = Me(t)
          , o = r.type
          , s = t.bbox
          , a = r.coordinates;
        if (s && !1 === function(e, t) {
            return !(t[0] > e[0] || t[1] > e[1] || e[0] > t[2] || e[1] > t[3])
        }(i, s))
            return !1;
        "Polygon" === o && (a = [a]);
        for (var l = !1, h = 0; a.length > h && !l; h++)
            if (Se(i, a[h][0], n.ignoreBoundary)) {
                for (var c = !1, u = 1; a[h].length > u && !c; )
                    Se(i, a[h][u], !n.ignoreBoundary) && (c = !0),
                    u++;
                c || (l = !0)
            }
        return l
    }
    function Se(e, t, n) {
        var i = !1;
        t[0][0] === t[t.length - 1][0] && t[0][1] === t[t.length - 1][1] && (t = t.slice(0, t.length - 1));
        for (var r = 0, o = t.length - 1; t.length > r; o = r++) {
            var s = t[r][0]
              , a = t[r][1]
              , l = t[o][0]
              , h = t[o][1];
            if (e[1] * (s - l) + a * (l - e[0]) + h * (e[0] - s) == 0 && 0 >= (s - e[0]) * (l - e[0]) && 0 >= (a - e[1]) * (h - e[1]))
                return !n;
            a > e[1] != h > e[1] && (l - s) * (e[1] - a) / (h - a) + s > e[0] && (i = !i)
        }
        return i
    }
    function Ae(e, t, n) {
        void 0 === n && (n = {});
        var i = we(e)
          , r = we(t)
          , o = ne(r[1] - i[1])
          , s = ne(r[0] - i[0])
          , a = ne(i[1])
          , l = ne(r[1])
          , h = Math.pow(Math.sin(o / 2), 2) + Math.pow(Math.sin(s / 2), 2) * Math.cos(a) * Math.cos(l);
        return q(2 * Math.atan2(Math.sqrt(h), Math.sqrt(1 - h)), n.units)
    }
    function Pe(e) {
        if (!e)
            throw Error("geojson is required");
        switch (e.type) {
        case "Feature":
            return Be(e);
        case "FeatureCollection":
            return function(e) {
                var t = {
                    type: "FeatureCollection"
                };
                return Object.keys(e).forEach((function(n) {
                    switch (n) {
                    case "type":
                    case "features":
                        return;
                    default:
                        t[n] = e[n]
                    }
                }
                )),
                t.features = e.features.map((function(e) {
                    return Be(e)
                }
                )),
                t
            }(e);
        case "Point":
        case "LineString":
        case "Polygon":
        case "MultiPoint":
        case "MultiLineString":
        case "MultiPolygon":
        case "GeometryCollection":
            return Ce(e);
        default:
            throw Error("unknown GeoJSON type")
        }
    }
    function Be(e) {
        var t = {
            type: "Feature"
        };
        return Object.keys(e).forEach((function(n) {
            switch (n) {
            case "type":
            case "properties":
            case "geometry":
                return;
            default:
                t[n] = e[n]
            }
        }
        )),
        t.properties = Ge(e.properties),
        t.geometry = Ce(e.geometry),
        t
    }
    function Ge(e) {
        var t = {};
        return e ? (Object.keys(e).forEach((function(n) {
            var i = e[n];
            t[n] = "object" == typeof i ? null === i ? null : Array.isArray(i) ? i.map((function(e) {
                return e
            }
            )) : Ge(i) : i
        }
        )),
        t) : t
    }
    function Ce(e) {
        var t = {
            type: e.type
        };
        return e.bbox && (t.bbox = e.bbox),
        "GeometryCollection" === e.type ? (t.geometries = e.geometries.map((function(e) {
            return Ce(e)
        }
        )),
        t) : (t.coordinates = Ie(e.coordinates),
        t)
    }
    function Ie(e) {
        var t = e;
        return "object" != typeof t[0] ? t.slice() : t.map((function(e) {
            return Ie(e)
        }
        ))
    }
    function Re(e, t, n, i) {
        void 0 === i && (i = {});
        var r = we(e)
          , o = ne(r[0])
          , s = ne(r[1])
          , a = ne(n)
          , l = $(t, i.units)
          , h = Math.asin(Math.sin(s) * Math.cos(l) + Math.cos(s) * Math.sin(l) * Math.cos(a));
        return J([te(o + Math.atan2(Math.sin(a) * Math.sin(l) * Math.cos(s), Math.cos(l) - Math.sin(s) * Math.sin(h))), te(h)], i.properties)
    }
    function Ne(e, t, n) {
        if (void 0 === n && (n = {}),
        !0 === n.final)
            return function(e, t) {
                var n = Ne(t, e);
                return n = (n + 180) % 360
            }(e, t);
        var i = we(e)
          , r = we(t)
          , o = ne(i[0])
          , s = ne(r[0])
          , a = ne(i[1])
          , l = ne(r[1]);
        return te(Math.atan2(Math.sin(s - o) * Math.cos(l), Math.cos(a) * Math.sin(l) - Math.sin(a) * Math.cos(l) * Math.cos(s - o)))
    }
    function De(e) {
        if (!e)
            throw Error("geojson is required");
        var t = [];
        return ve(e, (function(e) {
            !function(e, t) {
                var n = []
                  , i = e.geometry;
                if (null !== i) {
                    switch (i.type) {
                    case "Polygon":
                        n = Ee(i);
                        break;
                    case "LineString":
                        n = [Ee(i)]
                    }
                    n.forEach((function(n) {
                        var i = function(e, t) {
                            var n = [];
                            return e.reduce((function(e, i) {
                                var r, o, s, a, l, h, c = V([e, i], t);
                                return c.bbox = [(l = (o = i)[0]) > (s = (r = e)[0]) ? s : l, (h = o[1]) > (a = r[1]) ? a : h, s > l ? s : l, a > h ? a : h],
                                n.push(c),
                                i
                            }
                            )),
                            n
                        }(n, e.properties);
                        i.forEach((function(e) {
                            e.id = t.length,
                            t.push(e)
                        }
                        ))
                    }
                    ))
                }
            }(e, t)
        }
        )),
        Q(t)
    }
    function _e(e, t, n, i, r) {
        Te(e, t, n || 0, i || e.length - 1, r || We)
    }
    function Te(e, t, n, i, r) {
        for (; i > n; ) {
            if (i - n > 600) {
                var o = i - n + 1
                  , s = t - n + 1
                  , a = Math.log(o)
                  , l = .5 * Math.exp(2 * a / 3)
                  , h = .5 * Math.sqrt(a * l * (o - l) / o) * (0 > s - o / 2 ? -1 : 1);
                Te(e, t, Math.max(n, Math.floor(t - s * l / o + h)), Math.min(i, Math.floor(t + (o - s) * l / o + h)), r)
            }
            var c = e[t]
              , u = n
              , p = i;
            for (Fe(e, n, t),
            r(e[i], c) > 0 && Fe(e, n, i); p > u; ) {
                for (Fe(e, u, p),
                u++,
                p--; 0 > r(e[u], c); )
                    u++;
                for (; r(e[p], c) > 0; )
                    p--
            }
            0 === r(e[n], c) ? Fe(e, n, p) : Fe(e, ++p, i),
            p > t || (n = p + 1),
            t > p || (i = p - 1)
        }
    }
    function Fe(e, t, n) {
        var i = e[t];
        e[t] = e[n],
        e[n] = i
    }
    function We(e, t) {
        return t > e ? -1 : e > t ? 1 : 0
    }
    function ze(e, t, n) {
        if (!n)
            return t.indexOf(e);
        for (let i = 0; t.length > i; i++)
            if (n(e, t[i]))
                return i;
        return -1
    }
    function je(e, t) {
        Ue(e, 0, e.children.length, t, e)
    }
    function Ue(e, t, n, i, r) {
        r || (r = qe(null)),
        r.minX = 1 / 0,
        r.minY = 1 / 0,
        r.maxX = -1 / 0,
        r.maxY = -1 / 0;
        for (let o = t; n > o; o++) {
            const t = e.children[o];
            Ye(r, e.leaf ? i(t) : t)
        }
        return r
    }
    function Ye(e, t) {
        return e.minX = Math.min(e.minX, t.minX),
        e.minY = Math.min(e.minY, t.minY),
        e.maxX = Math.max(e.maxX, t.maxX),
        e.maxY = Math.max(e.maxY, t.maxY),
        e
    }
    function Je(e, t) {
        return e.minX - t.minX
    }
    function Xe(e, t) {
        return e.minY - t.minY
    }
    function Ve(e) {
        return (e.maxX - e.minX) * (e.maxY - e.minY)
    }
    function Qe(e) {
        return e.maxX - e.minX + (e.maxY - e.minY)
    }
    function He(e, t) {
        const n = Math.max(e.minX, t.minX)
          , i = Math.max(e.minY, t.minY)
          , r = Math.min(e.maxX, t.maxX)
          , o = Math.min(e.maxY, t.maxY);
        return Math.max(0, r - n) * Math.max(0, o - i)
    }
    function Ke(e, t) {
        return !(e.minX > t.minX || e.minY > t.minY || t.maxX > e.maxX || t.maxY > e.maxY)
    }
    function Ze(e, t) {
        return !(t.minX > e.maxX || t.minY > e.maxY || e.minX > t.maxX || e.minY > t.maxY)
    }
    function qe(e) {
        return {
            children: e,
            height: 1,
            leaf: !0,
            minX: 1 / 0,
            minY: 1 / 0,
            maxX: -1 / 0,
            maxY: -1 / 0
        }
    }
    function $e(e, t, n, i, r) {
        const o = [t, n];
        for (; o.length; ) {
            if (i >= (n = o.pop()) - (t = o.pop()))
                continue;
            const s = t + Math.ceil((n - t) / i / 2) * i;
            _e(e, s, t, n, r),
            o.push(t, s, s, n)
        }
    }
    var et = Object.freeze({
        __proto__: null,
        default: class {
            constructor(e=9) {
                this._maxEntries = Math.max(4, e),
                this._minEntries = Math.max(2, Math.ceil(.4 * this._maxEntries)),
                this.clear()
            }
            all() {
                return this._all(this.data, [])
            }
            search(e) {
                let t = this.data;
                const n = [];
                if (!Ze(e, t))
                    return n;
                const i = this.toBBox
                  , r = [];
                for (; t; ) {
                    for (let o = 0; t.children.length > o; o++) {
                        const s = t.children[o]
                          , a = t.leaf ? i(s) : s;
                        Ze(e, a) && (t.leaf ? n.push(s) : Ke(e, a) ? this._all(s, n) : r.push(s))
                    }
                    t = r.pop()
                }
                return n
            }
            collides(e) {
                let t = this.data;
                if (!Ze(e, t))
                    return !1;
                const n = [];
                for (; t; ) {
                    for (let i = 0; t.children.length > i; i++) {
                        const r = t.children[i]
                          , o = t.leaf ? this.toBBox(r) : r;
                        if (Ze(e, o)) {
                            if (t.leaf || Ke(e, o))
                                return !0;
                            n.push(r)
                        }
                    }
                    t = n.pop()
                }
                return !1
            }
            load(e) {
                if (!e || !e.length)
                    return this;
                if (this._minEntries > e.length) {
                    for (let t = 0; e.length > t; t++)
                        this.insert(e[t]);
                    return this
                }
                let t = this._build(e.slice(), 0, e.length - 1, 0);
                if (this.data.children.length)
                    if (this.data.height === t.height)
                        this._splitRoot(this.data, t);
                    else {
                        if (t.height > this.data.height) {
                            const e = this.data;
                            this.data = t,
                            t = e
                        }
                        this._insert(t, this.data.height - t.height - 1, !0)
                    }
                else
                    this.data = t;
                return this
            }
            insert(e) {
                return e && this._insert(e, this.data.height - 1),
                this
            }
            clear() {
                return this.data = qe([]),
                this
            }
            remove(e, t) {
                if (!e)
                    return this;
                let n = this.data;
                const i = this.toBBox(e)
                  , r = []
                  , o = [];
                let s, a, l;
                for (; n || r.length; ) {
                    if (n || (n = r.pop(),
                    a = r[r.length - 1],
                    s = o.pop(),
                    l = !0),
                    n.leaf) {
                        const i = ze(e, n.children, t);
                        if (-1 !== i)
                            return n.children.splice(i, 1),
                            r.push(n),
                            this._condense(r),
                            this
                    }
                    l || n.leaf || !Ke(n, i) ? a ? (s++,
                    n = a.children[s],
                    l = !1) : n = null : (r.push(n),
                    o.push(s),
                    s = 0,
                    a = n,
                    n = n.children[0])
                }
                return this
            }
            toBBox(e) {
                return e
            }
            compareMinX(e, t) {
                return e.minX - t.minX
            }
            compareMinY(e, t) {
                return e.minY - t.minY
            }
            toJSON() {
                return this.data
            }
            fromJSON(e) {
                return this.data = e,
                this
            }
            _all(e, t) {
                const n = [];
                for (; e; )
                    e.leaf ? t.push(...e.children) : n.push(...e.children),
                    e = n.pop();
                return t
            }
            _build(e, t, n, i) {
                const r = n - t + 1;
                let o, s = this._maxEntries;
                if (s >= r)
                    return o = qe(e.slice(t, n + 1)),
                    je(o, this.toBBox),
                    o;
                i || (s = Math.ceil(r / Math.pow(s, (i = Math.ceil(Math.log(r) / Math.log(s))) - 1))),
                o = qe([]),
                o.leaf = !1,
                o.height = i;
                const a = Math.ceil(r / s)
                  , l = a * Math.ceil(Math.sqrt(s));
                $e(e, t, n, l, this.compareMinX);
                for (let r = t; n >= r; r += l) {
                    const t = Math.min(r + l - 1, n);
                    $e(e, r, t, a, this.compareMinY);
                    for (let n = r; t >= n; n += a) {
                        o.children.push(this._build(e, n, Math.min(n + a - 1, t), i - 1))
                    }
                }
                return je(o, this.toBBox),
                o
            }
            _chooseSubtree(e, t, n, i) {
                for (; i.push(t),
                !t.leaf && i.length - 1 !== n; ) {
                    let n, i = 1 / 0, s = 1 / 0;
                    for (let a = 0; t.children.length > a; a++) {
                        const l = t.children[a]
                          , h = Ve(l)
                          , c = (Math.max((o = l).maxX, (r = e).maxX) - Math.min(o.minX, r.minX)) * (Math.max(o.maxY, r.maxY) - Math.min(o.minY, r.minY)) - h;
                        s > c ? (s = c,
                        i = i > h ? h : i,
                        n = l) : c === s && i > h && (i = h,
                        n = l)
                    }
                    t = n || t.children[0]
                }
                var r, o;
                return t
            }
            _insert(e, t, n) {
                const i = n ? e : this.toBBox(e)
                  , r = []
                  , o = this._chooseSubtree(i, this.data, t, r);
                for (o.children.push(e),
                Ye(o, i); t >= 0 && r[t].children.length > this._maxEntries; )
                    this._split(r, t),
                    t--;
                this._adjustParentBBoxes(i, r, t)
            }
            _split(e, t) {
                const n = e[t]
                  , i = n.children.length
                  , r = this._minEntries;
                this._chooseSplitAxis(n, r, i);
                const o = this._chooseSplitIndex(n, r, i)
                  , s = qe(n.children.splice(o, n.children.length - o));
                s.height = n.height,
                s.leaf = n.leaf,
                je(n, this.toBBox),
                je(s, this.toBBox),
                t ? e[t - 1].children.push(s) : this._splitRoot(n, s)
            }
            _splitRoot(e, t) {
                this.data = qe([e, t]),
                this.data.height = e.height + 1,
                this.data.leaf = !1,
                je(this.data, this.toBBox)
            }
            _chooseSplitIndex(e, t, n) {
                let i, r = 1 / 0, o = 1 / 0;
                for (let s = t; n - t >= s; s++) {
                    const t = Ue(e, 0, s, this.toBBox)
                      , a = Ue(e, s, n, this.toBBox)
                      , l = He(t, a)
                      , h = Ve(t) + Ve(a);
                    r > l ? (r = l,
                    i = s,
                    o = o > h ? h : o) : l === r && o > h && (o = h,
                    i = s)
                }
                return i || n - t
            }
            _chooseSplitAxis(e, t, n) {
                const i = e.leaf ? this.compareMinX : Je
                  , r = e.leaf ? this.compareMinY : Xe
                  , o = this._allDistMargin(e, t, n, i);
                this._allDistMargin(e, t, n, r) > o && e.children.sort(i)
            }
            _allDistMargin(e, t, n, i) {
                e.children.sort(i);
                const r = this.toBBox
                  , o = Ue(e, 0, t, r)
                  , s = Ue(e, n - t, n, r);
                let a = Qe(o) + Qe(s);
                for (let i = t; n - t > i; i++) {
                    const t = e.children[i];
                    Ye(o, e.leaf ? r(t) : t),
                    a += Qe(o)
                }
                for (let i = n - t - 1; i >= t; i--) {
                    const t = e.children[i];
                    Ye(s, e.leaf ? r(t) : t),
                    a += Qe(s)
                }
                return a
            }
            _adjustParentBBoxes(e, t, n) {
                for (let i = n; i >= 0; i--)
                    Ye(t[i], e)
            }
            _condense(e) {
                for (let t, n = e.length - 1; n >= 0; n--)
                    0 === e[n].children.length ? n > 0 ? (t = e[n - 1].children,
                    t.splice(t.indexOf(e[n]), 1)) : this.clear() : je(e[n], this.toBBox)
            }
        }
    })
      , tt = xe(et).default
      , nt = xe(se)
      , it = xe(me)
      , rt = xe(be).default
      , ot = it.featureEach
      , st = nt.featureCollection;
    function at(e) {
        var t = new tt(e);
        return t.insert = function(e) {
            if ("Feature" !== e.type)
                throw Error("invalid feature");
            return e.bbox = e.bbox ? e.bbox : rt(e),
            tt.prototype.insert.call(this, e)
        }
        ,
        t.load = function(e) {
            var t = [];
            return Array.isArray(e) ? e.forEach((function(e) {
                if ("Feature" !== e.type)
                    throw Error("invalid features");
                e.bbox = e.bbox ? e.bbox : rt(e),
                t.push(e)
            }
            )) : ot(e, (function(e) {
                if ("Feature" !== e.type)
                    throw Error("invalid features");
                e.bbox = e.bbox ? e.bbox : rt(e),
                t.push(e)
            }
            )),
            tt.prototype.load.call(this, t)
        }
        ,
        t.remove = function(e, t) {
            if ("Feature" !== e.type)
                throw Error("invalid feature");
            return e.bbox = e.bbox ? e.bbox : rt(e),
            tt.prototype.remove.call(this, e, t)
        }
        ,
        t.clear = function() {
            return tt.prototype.clear.call(this)
        }
        ,
        t.search = function(e) {
            var t = tt.prototype.search.call(this, this.toBBox(e));
            return st(t)
        }
        ,
        t.collides = function(e) {
            return tt.prototype.collides.call(this, this.toBBox(e))
        }
        ,
        t.all = function() {
            var e = tt.prototype.all.call(this);
            return st(e)
        }
        ,
        t.toJSON = function() {
            return tt.prototype.toJSON.call(this)
        }
        ,
        t.fromJSON = function(e) {
            return tt.prototype.fromJSON.call(this, e)
        }
        ,
        t.toBBox = function(e) {
            var t;
            if (e.bbox)
                t = e.bbox;
            else if (Array.isArray(e) && 4 === e.length)
                t = e;
            else if (Array.isArray(e) && 6 === e.length)
                t = [e[0], e[1], e[3], e[4]];
            else if ("Feature" === e.type)
                t = rt(e);
            else {
                if ("FeatureCollection" !== e.type)
                    throw Error("invalid geojson");
                t = rt(e)
            }
            return {
                minX: t[0],
                minY: t[1],
                maxX: t[2],
                maxY: t[3]
            }
        }
        ,
        t
    }
    var lt = at;
    function ht(e, t) {
        var n = {}
          , i = [];
        if ("LineString" === e.type && (e = Y(e)),
        "LineString" === t.type && (t = Y(t)),
        "Feature" === e.type && "Feature" === t.type && null !== e.geometry && null !== t.geometry && "LineString" === e.geometry.type && "LineString" === t.geometry.type && 2 === e.geometry.coordinates.length && 2 === t.geometry.coordinates.length) {
            var r = ct(e, t);
            return r && i.push(r),
            Q(i)
        }
        var o = lt();
        return o.load(De(t)),
        he(De(e), (function(e) {
            he(o.search(e), (function(t) {
                var r = ct(e, t);
                if (r) {
                    var o = Ee(r).join(",");
                    n[o] || (n[o] = !0,
                    i.push(r))
                }
            }
            ))
        }
        )),
        Q(i)
    }
    function ct(e, t) {
        var n = Ee(e)
          , i = Ee(t);
        if (2 !== n.length)
            throw Error("<intersects> line1 must only contain 2 coordinates");
        if (2 !== i.length)
            throw Error("<intersects> line2 must only contain 2 coordinates");
        var r = n[0][0]
          , o = n[0][1]
          , s = n[1][0]
          , a = n[1][1]
          , l = i[0][0]
          , h = i[0][1]
          , c = i[1][0]
          , u = i[1][1]
          , p = (u - h) * (s - r) - (c - l) * (a - o)
          , v = (c - l) * (o - h) - (u - h) * (r - l)
          , d = (s - r) * (o - h) - (a - o) * (r - l);
        if (0 === p)
            return null;
        var f = v / p
          , g = d / p;
        return 0 > f || f > 1 || 0 > g || g > 1 ? null : J([r + f * (s - r), o + f * (a - o)])
    }
    function ut(e, t, n) {
        void 0 === n && (n = {});
        var i = J([1 / 0, 1 / 0], {
            dist: 1 / 0
        })
          , r = 0;
        return ve(e, (function(e) {
            for (var o = Ee(e), s = 0; o.length - 1 > s; s++) {
                var a = J(o[s]);
                a.properties.dist = Ae(t, a, n);
                var l = J(o[s + 1]);
                l.properties.dist = Ae(t, l, n);
                var h = Ae(a, l, n)
                  , c = Math.max(a.properties.dist, l.properties.dist)
                  , u = Ne(a, l)
                  , p = Re(t, c, u + 90, n)
                  , v = Re(t, c, u - 90, n)
                  , d = ht(V([p.geometry.coordinates, v.geometry.coordinates]), V([a.geometry.coordinates, l.geometry.coordinates]))
                  , f = null;
                d.features.length > 0 && ((f = d.features[0]).properties.dist = Ae(t, f, n),
                f.properties.location = r + Ae(a, f, n)),
                i.properties.dist > a.properties.dist && ((i = a).properties.index = s,
                i.properties.location = r),
                i.properties.dist > l.properties.dist && ((i = l).properties.index = s + 1,
                i.properties.location = r + h),
                f && i.properties.dist > f.properties.dist && ((i = f).properties.index = s),
                r += h
            }
        }
        )),
        i
    }
    function pt(e, t, n) {
        void 0 === n && (n = {});
        var i = we(e)
          , r = we(t);
        r[0] += r[0] - i[0] > 180 ? -360 : i[0] - r[0] > 180 ? 360 : 0;
        var o = function(e, t, n) {
            var i = n = void 0 === n ? z : Number(n)
              , r = e[1] * Math.PI / 180
              , o = t[1] * Math.PI / 180
              , s = o - r
              , a = Math.abs(t[0] - e[0]) * Math.PI / 180;
            a > Math.PI && (a -= 2 * Math.PI);
            var l = Math.log(Math.tan(o / 2 + Math.PI / 4) / Math.tan(r / 2 + Math.PI / 4))
              , h = Math.abs(l) > 1e-11 ? s / l : Math.cos(r);
            return Math.sqrt(s * s + h * h * a * a) * i
        }(i, r);
        return ie(o, "meters", n.units)
    }
    function vt(e, t, n) {
        if (void 0 === n && (n = {}),
        n.method || (n.method = "geodesic"),
        n.units || (n.units = "kilometers"),
        !e)
            throw Error("pt is required");
        if (Array.isArray(e) ? e = J(e) : "Point" === e.type ? e = Y(e) : ke(e, "Point", "point"),
        !t)
            throw Error("line is required");
        Array.isArray(t) ? t = V(t) : "LineString" === t.type ? t = Y(t) : ke(t, "LineString", "line");
        var i = 1 / 0
          , r = e.geometry.coordinates;
        return de(t, (function(e) {
            var t = function(e, t, n, i) {
                var r = [n[0] - t[0], n[1] - t[1]]
                  , o = [e[0] - t[0], e[1] - t[1]]
                  , s = dt(o, r);
                if (0 >= s)
                    return ft(e, t, {
                        method: i.method,
                        units: "degrees"
                    });
                var a = dt(r, r);
                if (s >= a)
                    return ft(e, n, {
                        method: i.method,
                        units: "degrees"
                    });
                var l = s / a
                  , h = [t[0] + l * r[0], t[1] + l * r[1]];
                return ft(e, h, {
                    method: i.method,
                    units: "degrees"
                })
            }(r, e.geometry.coordinates[0], e.geometry.coordinates[1], n);
            i > t && (i = t)
        }
        )),
        ie(i, "degrees", n.units)
    }
    function dt(e, t) {
        return e[0] * t[0] + e[1] * t[1]
    }
    function ft(e, t, n) {
        return "planar" === n.method ? pt(e, t, n) : Ae(e, t, n)
    }
    lt.default = at;
    var gt = 6378137;
    function mt(e) {
        return pe(e, (function(e, t) {
            return e + function(e) {
                var t, n = 0;
                switch (e.type) {
                case "Polygon":
                    return yt(e.coordinates);
                case "MultiPolygon":
                    for (t = 0; e.coordinates.length > t; t++)
                        n += yt(e.coordinates[t]);
                    return n;
                case "Point":
                case "MultiPoint":
                case "LineString":
                case "MultiLineString":
                    return 0
                }
                return 0
            }(t)
        }
        ), 0)
    }
    function yt(e) {
        var t = 0;
        if (e && e.length > 0) {
            t += Math.abs(bt(e[0]));
            for (var n = 1; e.length > n; n++)
                t -= Math.abs(bt(e[n]))
        }
        return t
    }
    function bt(e) {
        var t, n, i, r, o, s, a = 0, l = e.length;
        if (l > 2) {
            for (s = 0; l > s; s++)
                s === l - 2 ? (i = l - 2,
                r = l - 1,
                o = 0) : s === l - 1 ? (i = l - 1,
                r = 0,
                o = 1) : (i = s,
                r = s + 1,
                o = s + 2),
                t = e[i],
                n = e[r],
                a += (wt(e[o][0]) - wt(t[0])) * Math.sin(wt(n[1]));
            a = a * gt * gt / 2
        }
        return a
    }
    function wt(e) {
        return e * Math.PI / 180
    }
    function Et(e, t, n) {
        void 0 === n && (n = {});
        for (var i = we(e), r = Ee(t), o = 0; r.length - 1 > o; o++) {
            var s = !1;
            if (n.ignoreEndVertices && (0 === o && (s = "start"),
            o === r.length - 2 && (s = "end"),
            0 === o && o + 1 === r.length - 1 && (s = "both")),
            kt(r[o], r[o + 1], i, s, void 0 === n.epsilon ? null : n.epsilon))
                return !0
        }
        return !1
    }
    function kt(e, t, n, i, r) {
        var o = n[0]
          , s = n[1]
          , a = e[0]
          , l = e[1]
          , h = t[0]
          , c = t[1]
          , u = h - a
          , p = c - l
          , v = (n[0] - a) * p - (n[1] - l) * u;
        if (null !== r) {
            if (Math.abs(v) > r)
                return !1
        } else if (0 !== v)
            return !1;
        return i ? "start" === i ? Math.abs(p) > Math.abs(u) ? p > 0 ? s > l && c >= s : s >= c && l > s : u > 0 ? o > a && h >= o : o >= h && a > o : "end" === i ? Math.abs(p) > Math.abs(u) ? p > 0 ? s >= l && c > s : s > c && l >= s : u > 0 ? o >= a && h > o : o > h && a >= o : "both" === i && (Math.abs(p) > Math.abs(u) ? p > 0 ? s > l && c > s : s > c && l > s : u > 0 ? o > a && h > o : o > h && a > o) : Math.abs(p) > Math.abs(u) ? p > 0 ? s >= l && c >= s : s >= c && l >= s : u > 0 ? o >= a && h >= o : o >= h && a >= o
    }
    function Mt(e, t) {
        void 0 === t && (t = {});
        var n = t.precision
          , i = t.coordinates
          , r = t.mutate;
        if (n = null == n || isNaN(n) ? 6 : n,
        i = null == i || isNaN(i) ? 3 : i,
        !e)
            throw Error("<geojson> is required");
        if ("number" != typeof n)
            throw Error("<precision> must be a number");
        if ("number" != typeof i)
            throw Error("<coordinates> must be a number");
        !1 !== r && void 0 !== r || (e = JSON.parse(JSON.stringify(e)));
        var o = Math.pow(10, n);
        return ae(e, (function(e) {
            !function(e, t, n) {
                e.length > n && e.splice(n, e.length);
                for (var i = 0; e.length > i; i++)
                    e[i] = Math.round(e[i] * t) / t
            }(e, o, i)
        }
        )),
        e
    }
    function Lt(e, t) {
        var n = []
          , i = lt();
        return ve(t, (function(t) {
            if (n.forEach((function(e, t) {
                e.id = t
            }
            )),
            n.length) {
                var r = i.search(t);
                if (r.features.length) {
                    var o = Ot(t, r);
                    n = n.filter((function(e) {
                        return e.id !== o.id
                    }
                    )),
                    i.remove(o),
                    he(xt(o, t), (function(e) {
                        n.push(e),
                        i.insert(e)
                    }
                    ))
                }
            } else
                (n = xt(e, t).features).forEach((function(e) {
                    e.bbox || (e.bbox = function(e) {
                        var t = e[0]
                          , n = e[1]
                          , i = e[2]
                          , r = e[3]
                          , o = Ae(e.slice(0, 2), [i, n]);
                        if (Ae(e.slice(0, 2), [t, r]) > o) {
                            var s = (t + i) / 2;
                            return [s - (r - n) / 2, n, s + (r - n) / 2, r]
                        }
                        var a = (n + r) / 2;
                        return [t, a - (i - t) / 2, i, a + (i - t) / 2]
                    }(ye(e)))
                }
                )),
                i.load(Q(n))
        }
        )),
        Q(n)
    }
    function xt(e, t) {
        var n = []
          , i = Ee(e)[0]
          , r = Ee(e)[e.geometry.coordinates.length - 1];
        if (St(i, we(t)) || St(r, we(t)))
            return Q([e]);
        var o = lt()
          , s = De(e);
        o.load(s);
        var a = o.search(t);
        if (!a.features.length)
            return Q([e]);
        var l = Ot(t, a)
          , h = ce(s, (function(e, i, r) {
            var o = Ee(i)[1]
              , s = we(t);
            return r === l.id ? (e.push(s),
            n.push(V(e)),
            St(s, o) ? [s] : [s, o]) : (e.push(o),
            e)
        }
        ), [i]);
        return h.length > 1 && n.push(V(h)),
        Q(n)
    }
    function Ot(e, t) {
        if (!t.features.length)
            throw Error("lines must contain features");
        if (1 === t.features.length)
            return t.features[0];
        var n, i = 1 / 0;
        return he(t, (function(t) {
            var r = ut(t, e).properties.dist;
            i > r && (n = t,
            i = r)
        }
        )),
        n
    }
    function St(e, t) {
        return e[0] === t[0] && e[1] === t[1]
    }
    function At(e, t) {
        void 0 === t && (t = {});
        var n = Me(e);
        switch (t.properties || "Feature" !== e.type || (t.properties = e.properties),
        n.type) {
        case "Polygon":
            return function(e, t) {
                void 0 === t && (t = {});
                var n = Me(e)
                  , i = n.coordinates
                  , r = t.properties ? t.properties : "Feature" === e.type ? e.properties : {};
                return Pt(i, r)
            }(n, t);
        case "MultiPolygon":
            return function(e, t) {
                void 0 === t && (t = {});
                var n = Me(e)
                  , i = n.coordinates
                  , r = t.properties ? t.properties : "Feature" === e.type ? e.properties : {}
                  , o = [];
                return i.forEach((function(e) {
                    o.push(Pt(e, r))
                }
                )),
                Q(o)
            }(n, t);
        default:
            throw Error("invalid poly")
        }
    }
    function Pt(e, t) {
        return e.length > 1 ? H(e, t) : V(e[0], t)
    }
    function Bt(e, t) {
        var n, i, r;
        void 0 === t && (t = {});
        var o = t.properties
          , s = null === (n = t.autoComplete) || void 0 === n || n
          , a = null === (i = t.orderCoords) || void 0 === i || i;
        if (null !== (r = t.mutate) && void 0 !== r && r || (e = Pe(e)),
        "FeatureCollection" === e.type) {
            var l = [];
            return e.features.forEach((function(e) {
                l.push(Ee(Gt(e, {}, s, a)))
            }
            )),
            Z(l, o)
        }
        return Gt(e, o, s, a)
    }
    function Gt(e, t, n, i) {
        t = t || ("Feature" === e.type ? e.properties : {});
        var r = Me(e)
          , o = r.coordinates
          , s = r.type;
        if (!o.length)
            throw Error("line must contain coordinates");
        switch (s) {
        case "LineString":
            return n && (o = Ct(o)),
            X([o], t);
        case "MultiLineString":
            var a = []
              , l = 0;
            return o.forEach((function(e) {
                if (n && (e = Ct(e)),
                i) {
                    var t = function(e) {
                        var t = e[0]
                          , n = e[1]
                          , i = e[2]
                          , r = e[3];
                        return Math.abs(t - i) * Math.abs(n - r)
                    }(ye(V(e)));
                    t > l ? (a.unshift(e),
                    l = t) : a.push(e)
                } else
                    a.push(e)
            }
            )),
            X(a, t);
        default:
            throw Error("geometry type " + s + " is not supported")
        }
    }
    function Ct(e) {
        var t = e[0]
          , n = e[e.length - 1];
        return t[0] === n[0] && t[1] === n[1] || e.push(t),
        e
    }
    function It(e, t) {
        var n = ne(e[1])
          , i = ne(t[1])
          , r = ne(t[0] - e[0]);
        return r > Math.PI && (r -= 2 * Math.PI),
        -Math.PI > r && (r += 2 * Math.PI),
        (te(Math.atan2(r, Math.log(Math.tan(i / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)))) + 360) % 360
    }
    function Rt(e, t, n, i) {
        void 0 === i && (i = {});
        var r = 0 > t
          , o = ie(Math.abs(t), i.units, "meters");
        r && (o = -Math.abs(o));
        var s = we(e)
          , a = function(e, t, n, i) {
            i = void 0 === i ? z : Number(i);
            var r = t / i
              , o = e[0] * Math.PI / 180
              , s = ne(e[1])
              , a = ne(n)
              , l = r * Math.cos(a)
              , h = s + l;
            Math.abs(h) > Math.PI / 2 && (h = h > 0 ? Math.PI - h : -Math.PI - h);
            var c = Math.log(Math.tan(h / 2 + Math.PI / 4) / Math.tan(s / 2 + Math.PI / 4))
              , u = Math.abs(c) > 1e-11 ? l / c : Math.cos(s);
            return [(180 * (o + r * Math.sin(a) / u) / Math.PI + 540) % 360 - 180, 180 * h / Math.PI]
        }(s, o, n);
        return a[0] += a[0] - s[0] > 180 ? -360 : s[0] - a[0] > 180 ? 360 : 0,
        J(a, i.properties)
    }
    function Nt(e) {
        var t = e[0]
          , n = e[1];
        return [n[0] - t[0], n[1] - t[1]]
    }
    function Dt(e, t) {
        return e[0] * t[1] - t[0] * e[1]
    }
    function _t(e, t) {
        return !function(e, t) {
            return 0 === Dt(Nt(e), Nt(t))
        }(e, t) && function(e, t) {
            var n, i, r = e[0], o = Nt(e), s = t[0], a = Nt(t), l = Dt(o, a), h = function(e, t) {
                return [e[0] + t[0], e[1] + t[1]]
            }(r, function(e, t) {
                return [e * t[0], e * t[1]]
            }(Dt([(n = s)[0] - (i = r)[0], n[1] - i[1]], a) / l, o));
            return h
        }(e, t)
    }
    function Tt(e, t, n) {
        if (!oe(n = n || {}))
            throw Error("options is invalid");
        var i = n.units;
        if (!e)
            throw Error("geojson is required");
        if (null == t || isNaN(t))
            throw Error("distance is required");
        var r = Le(e)
          , o = e.properties;
        switch (r) {
        case "LineString":
            return Ft(e, t, i);
        case "MultiLineString":
            var s = [];
            return ve(e, (function(e) {
                s.push(Ft(e, t, i).geometry.coordinates)
            }
            )),
            H(s, o);
        default:
            throw Error("geometry " + r + " is not supported")
        }
    }
    function Ft(e, t, n) {
        var i = []
          , r = ee(t, n)
          , o = Ee(e)
          , s = [];
        return o.forEach((function(e, t) {
            if (t !== o.length - 1) {
                var n = [[(h = e)[0] + (u = r) * ((c = o[t + 1])[1] - h[1]) / (p = Math.sqrt((h[0] - c[0]) * (h[0] - c[0]) + (h[1] - c[1]) * (h[1] - c[1]))), h[1] + u * (h[0] - c[0]) / p], [c[0] + u * (c[1] - h[1]) / p, c[1] + u * (h[0] - c[0]) / p]];
                if (i.push(n),
                t > 0) {
                    var a = i[t - 1]
                      , l = _t(n, a);
                    !1 !== l && (a[1] = l,
                    n[0] = l),
                    s.push(a[0]),
                    t === o.length - 2 && (s.push(n[0]),
                    s.push(n[1]))
                }
                2 === o.length && (s.push(n[0]),
                s.push(n[1]))
            }
            var h, c, u, p
        }
        )),
        V(s, e.properties)
    }
    function Wt(e, t) {
        var n = !0;
        return ve(e, (function(e) {
            ve(t, (function(t) {
                if (!1 === n)
                    return !1;
                n = function(e, t) {
                    switch (e.type) {
                    case "Point":
                        switch (t.type) {
                        case "Point":
                            return !((n = e.coordinates)[0] === (i = t.coordinates)[0] && n[1] === i[1]);
                        case "LineString":
                            return !zt(t, e);
                        case "Polygon":
                            return !Oe(e, t)
                        }
                        break;
                    case "LineString":
                        switch (t.type) {
                        case "Point":
                            return !zt(e, t);
                        case "LineString":
                            return !function(e, t) {
                                if (ht(e, t).features.length > 0)
                                    return !0;
                                return !1
                            }(e, t);
                        case "Polygon":
                            return !jt(t, e)
                        }
                        break;
                    case "Polygon":
                        switch (t.type) {
                        case "Point":
                            return !Oe(t, e);
                        case "LineString":
                            return !jt(e, t);
                        case "Polygon":
                            return !function(e, t) {
                                for (var n = 0, i = e.coordinates[0]; i.length > n; n++) {
                                    if (Oe(i[n], t))
                                        return !0
                                }
                                for (var r = 0, o = t.coordinates[0]; o.length > r; r++) {
                                    if (Oe(o[r], e))
                                        return !0
                                }
                                var s = ht(At(e), At(t));
                                if (s.features.length > 0)
                                    return !0;
                                return !1
                            }(t, e)
                        }
                    }
                    var n, i;
                    return !1
                }(e.geometry, t.geometry)
            }
            ))
        }
        )),
        n
    }
    function zt(e, t) {
        for (var n = 0; e.coordinates.length - 1 > n; n++)
            if (Ut(e.coordinates[n], e.coordinates[n + 1], t.coordinates))
                return !0;
        return !1
    }
    function jt(e, t) {
        for (var n = 0, i = t.coordinates; i.length > n; n++) {
            if (Oe(i[n], e))
                return !0
        }
        return ht(t, At(e)).features.length > 0
    }
    function Ut(e, t, n) {
        var i = t[0] - e[0]
          , r = t[1] - e[1];
        return 0 == (n[0] - e[0]) * r - (n[1] - e[1]) * i && (Math.abs(r) > Math.abs(i) ? r > 0 ? n[1] >= e[1] && t[1] >= n[1] : n[1] >= t[1] && e[1] >= n[1] : i > 0 ? n[0] >= e[0] && t[0] >= n[0] : n[0] >= t[0] && e[0] >= n[0])
    }
    function Yt(e, t) {
        var n = Me(e)
          , i = Me(t)
          , r = n.type
          , o = i.type
          , s = n.coordinates
          , a = i.coordinates;
        switch (r) {
        case "Point":
            if ("Point" === o)
                return Xt(s, a);
            throw Error("feature2 " + o + " geometry not supported");
        case "MultiPoint":
            switch (o) {
            case "Point":
                return function(e, t) {
                    var n, i = !1;
                    for (n = 0; e.coordinates.length > n; n++)
                        if (Xt(e.coordinates[n], t.coordinates)) {
                            i = !0;
                            break
                        }
                    return i
                }(n, i);
            case "MultiPoint":
                return function(e, t) {
                    for (var n = 0, i = t.coordinates; i.length > n; n++) {
                        for (var r = i[n], o = !1, s = 0, a = e.coordinates; a.length > s; s++) {
                            if (Xt(r, a[s])) {
                                o = !0;
                                break
                            }
                        }
                        if (!o)
                            return !1
                    }
                    return !0
                }(n, i);
            default:
                throw Error("feature2 " + o + " geometry not supported")
            }
        case "LineString":
            switch (o) {
            case "Point":
                return Et(i, n, {
                    ignoreEndVertices: !0
                });
            case "LineString":
                return function(e, t) {
                    for (var n = !1, i = 0, r = t.coordinates; r.length > i; i++) {
                        var o = r[i];
                        if (Et({
                            type: "Point",
                            coordinates: o
                        }, e, {
                            ignoreEndVertices: !0
                        }) && (n = !0),
                        !Et({
                            type: "Point",
                            coordinates: o
                        }, e, {
                            ignoreEndVertices: !1
                        }))
                            return !1
                    }
                    return n
                }(n, i);
            case "MultiPoint":
                return function(e, t) {
                    for (var n = !1, i = 0, r = t.coordinates; r.length > i; i++) {
                        var o = r[i];
                        if (Et(o, e, {
                            ignoreEndVertices: !0
                        }) && (n = !0),
                        !Et(o, e))
                            return !1
                    }
                    if (n)
                        return !0;
                    return !1
                }(n, i);
            default:
                throw Error("feature2 " + o + " geometry not supported")
            }
        case "Polygon":
            switch (o) {
            case "Point":
                return Oe(i, n, {
                    ignoreBoundary: !0
                });
            case "LineString":
                return function(e, t) {
                    var n = !1
                      , i = 0
                      , r = ye(e)
                      , o = ye(t);
                    if (!Jt(r, o))
                        return !1;
                    for (; t.coordinates.length - 1 > i; i++) {
                        if (Oe({
                            type: "Point",
                            coordinates: Vt(t.coordinates[i], t.coordinates[i + 1])
                        }, e, {
                            ignoreBoundary: !0
                        })) {
                            n = !0;
                            break
                        }
                    }
                    return n
                }(n, i);
            case "Polygon":
                return function(e, t) {
                    if ("Feature" === e.type && null === e.geometry)
                        return !1;
                    if ("Feature" === t.type && null === t.geometry)
                        return !1;
                    var n = ye(e)
                      , i = ye(t);
                    if (!Jt(n, i))
                        return !1;
                    for (var r = Me(t).coordinates, o = 0, s = r; s.length > o; o++)
                        for (var a = 0, l = s[o]; l.length > a; a++) {
                            if (!Oe(l[a], e))
                                return !1
                        }
                    return !0
                }(n, i);
            case "MultiPoint":
                return function(e, t) {
                    for (var n = 0, i = t.coordinates; i.length > n; n++) {
                        if (!Oe(i[n], e, {
                            ignoreBoundary: !0
                        }))
                            return !1
                    }
                    return !0
                }(n, i);
            default:
                throw Error("feature2 " + o + " geometry not supported")
            }
        default:
            throw Error("feature1 " + r + " geometry not supported")
        }
    }
    function Jt(e, t) {
        return t[0] >= e[0] && (e[2] >= t[2] && (t[1] >= e[1] && t[3] <= e[3]))
    }
    function Xt(e, t) {
        return e[0] === t[0] && e[1] === t[1]
    }
    function Vt(e, t) {
        return [(e[0] + t[0]) / 2, (e[1] + t[1]) / 2]
    }
    /**
 * splaytree v3.1.2
 * Fast Splay tree for Node and browser
 *
 * @author Alexander Milevski <info@w8r.name>
 * @license MIT
 * @preserve
 */
    /*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
    function Qt(e, t) {
        var n, i, r, o, s = {
            label: 0,
            sent: function() {
                if (1 & r[0])
                    throw r[1];
                return r[1]
            },
            trys: [],
            ops: []
        };
        return o = {
            next: a(0),
            throw: a(1),
            return: a(2)
        },
        "function" == typeof Symbol && (o[Symbol.iterator] = function() {
            return this
        }
        ),
        o;
        function a(o) {
            return function(a) {
                return function(o) {
                    if (n)
                        throw new TypeError("Generator is already executing.");
                    for (; s; )
                        try {
                            if (n = 1,
                            i && (r = 2 & o[0] ? i.return : o[0] ? i.throw || ((r = i.return) && r.call(i),
                            0) : i.next) && !(r = r.call(i, o[1])).done)
                                return r;
                            switch (i = 0,
                            r && (o = [2 & o[0], r.value]),
                            o[0]) {
                            case 0:
                            case 1:
                                r = o;
                                break;
                            case 4:
                                return s.label++,
                                {
                                    value: o[1],
                                    done: !1
                                };
                            case 5:
                                s.label++,
                                i = o[1],
                                o = [0];
                                continue;
                            case 7:
                                o = s.ops.pop(),
                                s.trys.pop();
                                continue;
                            default:
                                if (!(r = s.trys,
                                (r = r.length > 0 && r[r.length - 1]) || 6 !== o[0] && 2 !== o[0])) {
                                    s = 0;
                                    continue
                                }
                                if (3 === o[0] && (!r || o[1] > r[0] && r[3] > o[1])) {
                                    s.label = o[1];
                                    break
                                }
                                if (6 === o[0] && r[1] > s.label) {
                                    s.label = r[1],
                                    r = o;
                                    break
                                }
                                if (r && r[2] > s.label) {
                                    s.label = r[2],
                                    s.ops.push(o);
                                    break
                                }
                                r[2] && s.ops.pop(),
                                s.trys.pop();
                                continue
                            }
                            o = t.call(e, s)
                        } catch (e) {
                            o = [6, e],
                            i = 0
                        } finally {
                            n = r = 0
                        }
                    if (5 & o[0])
                        throw o[1];
                    return {
                        value: o[0] ? o[1] : void 0,
                        done: !0
                    }
                }([o, a])
            }
        }
    }
    var Ht = function(e, t) {
        this.next = null,
        this.key = e,
        this.data = t,
        this.left = null,
        this.right = null
    };
    function Kt(e, t) {
        return e > t ? 1 : t > e ? -1 : 0
    }
    function Zt(e, t, n) {
        for (var i = new Ht(null,null), r = i, o = i; ; ) {
            var s = n(e, t.key);
            if (0 > s) {
                if (null === t.left)
                    break;
                if (0 > n(e, t.left.key))
                    if (t.left = (a = t.left).right,
                    a.right = t,
                    null === (t = a).left)
                        break;
                o.left = t,
                o = t,
                t = t.left
            } else {
                if (0 >= s)
                    break;
                if (null === t.right)
                    break;
                var a;
                if (n(e, t.right.key) > 0 && (t.right = (a = t.right).left,
                a.left = t,
                null === (t = a).right))
                    break;
                r.right = t,
                r = t,
                t = t.right
            }
        }
        return r.right = t.left,
        o.left = t.right,
        t.left = i.right,
        t.right = i.left,
        t
    }
    function qt(e, t, n, i) {
        var r = new Ht(e,t);
        if (null === n)
            return r.left = r.right = null,
            r;
        var o = i(e, (n = Zt(e, n, i)).key);
        return 0 > o ? (r.left = n.left,
        r.right = n,
        n.left = null) : 0 > o || (r.right = n.right,
        r.left = n,
        n.right = null),
        r
    }
    function $t(e, t, n) {
        var i = null
          , r = null;
        if (t) {
            var o = n((t = Zt(e, t, n)).key, e);
            0 === o ? (i = t.left,
            r = t.right) : 0 > o ? (r = t.right,
            t.right = null,
            i = t) : (i = t.left,
            t.left = null,
            r = t)
        }
        return {
            left: i,
            right: r
        }
    }
    function en(e, t, n, i, r) {
        if (e) {
            i(t + (n ? "└── " : "├── ") + r(e) + "\n");
            var o = t + (n ? "    " : "│   ");
            e.left && en(e.left, o, !1, i, r),
            e.right && en(e.right, o, !0, i, r)
        }
    }
    var tn = function() {
        function e(e) {
            void 0 === e && (e = Kt),
            this._root = null,
            this._size = 0,
            this._comparator = e
        }
        return e.prototype.insert = function(e, t) {
            return this._size++,
            this._root = qt(e, t, this._root, this._comparator)
        }
        ,
        e.prototype.add = function(e, t) {
            var n = new Ht(e,t);
            null === this._root && (n.left = n.right = null,
            this._size++,
            this._root = n);
            var i = this._comparator
              , r = Zt(e, this._root, i)
              , o = i(e, r.key);
            return 0 === o ? this._root = r : (0 > o ? (n.left = r.left,
            n.right = r,
            r.left = null) : o > 0 && (n.right = r.right,
            n.left = r,
            r.right = null),
            this._size++,
            this._root = n),
            this._root
        }
        ,
        e.prototype.remove = function(e) {
            this._root = this._remove(e, this._root, this._comparator)
        }
        ,
        e.prototype._remove = function(e, t, n) {
            var i;
            return null === t ? null : 0 === n(e, (t = Zt(e, t, n)).key) ? (null === t.left ? i = t.right : (i = Zt(e, t.left, n)).right = t.right,
            this._size--,
            i) : t
        }
        ,
        e.prototype.pop = function() {
            var e = this._root;
            if (e) {
                for (; e.left; )
                    e = e.left;
                return this._root = Zt(e.key, this._root, this._comparator),
                this._root = this._remove(e.key, this._root, this._comparator),
                {
                    key: e.key,
                    data: e.data
                }
            }
            return null
        }
        ,
        e.prototype.findStatic = function(e) {
            for (var t = this._root, n = this._comparator; t; ) {
                var i = n(e, t.key);
                if (0 === i)
                    return t;
                t = 0 > i ? t.left : t.right
            }
            return null
        }
        ,
        e.prototype.find = function(e) {
            return this._root && (this._root = Zt(e, this._root, this._comparator),
            0 !== this._comparator(e, this._root.key)) ? null : this._root
        }
        ,
        e.prototype.contains = function(e) {
            for (var t = this._root, n = this._comparator; t; ) {
                var i = n(e, t.key);
                if (0 === i)
                    return !0;
                t = 0 > i ? t.left : t.right
            }
            return !1
        }
        ,
        e.prototype.forEach = function(e, t) {
            for (var n = this._root, i = [], r = !1; !r; )
                null !== n ? (i.push(n),
                n = n.left) : 0 !== i.length ? (n = i.pop(),
                e.call(t, n),
                n = n.right) : r = !0;
            return this
        }
        ,
        e.prototype.range = function(e, t, n, i) {
            for (var r = [], o = this._comparator, s = this._root; 0 !== r.length || s; )
                if (s)
                    r.push(s),
                    s = s.left;
                else {
                    if (o((s = r.pop()).key, t) > 0)
                        break;
                    if (o(s.key, e) >= 0 && n.call(i, s))
                        return this;
                    s = s.right
                }
            return this
        }
        ,
        e.prototype.keys = function() {
            var e = [];
            return this.forEach((function(t) {
                return e.push(t.key)
            }
            )),
            e
        }
        ,
        e.prototype.values = function() {
            var e = [];
            return this.forEach((function(t) {
                return e.push(t.data)
            }
            )),
            e
        }
        ,
        e.prototype.min = function() {
            return this._root ? this.minNode(this._root).key : null
        }
        ,
        e.prototype.max = function() {
            return this._root ? this.maxNode(this._root).key : null
        }
        ,
        e.prototype.minNode = function(e) {
            if (void 0 === e && (e = this._root),
            e)
                for (; e.left; )
                    e = e.left;
            return e
        }
        ,
        e.prototype.maxNode = function(e) {
            if (void 0 === e && (e = this._root),
            e)
                for (; e.right; )
                    e = e.right;
            return e
        }
        ,
        e.prototype.at = function(e) {
            for (var t = this._root, n = !1, i = 0, r = []; !n; )
                if (t)
                    r.push(t),
                    t = t.left;
                else if (r.length > 0) {
                    if (t = r.pop(),
                    i === e)
                        return t;
                    i++,
                    t = t.right
                } else
                    n = !0;
            return null
        }
        ,
        e.prototype.next = function(e) {
            var t = this._root
              , n = null;
            if (e.right) {
                for (n = e.right; n.left; )
                    n = n.left;
                return n
            }
            for (var i = this._comparator; t; ) {
                var r = i(e.key, t.key);
                if (0 === r)
                    break;
                0 > r ? (n = t,
                t = t.left) : t = t.right
            }
            return n
        }
        ,
        e.prototype.prev = function(e) {
            var t = this._root
              , n = null;
            if (null !== e.left) {
                for (n = e.left; n.right; )
                    n = n.right;
                return n
            }
            for (var i = this._comparator; t; ) {
                var r = i(e.key, t.key);
                if (0 === r)
                    break;
                0 > r ? t = t.left : (n = t,
                t = t.right)
            }
            return n
        }
        ,
        e.prototype.clear = function() {
            return this._root = null,
            this._size = 0,
            this
        }
        ,
        e.prototype.toList = function() {
            return function(e) {
                var t = e
                  , n = []
                  , i = !1
                  , r = new Ht(null,null)
                  , o = r;
                for (; !i; )
                    t ? (n.push(t),
                    t = t.left) : n.length > 0 ? t = (t = o = o.next = n.pop()).right : i = !0;
                return o.next = null,
                r.next
            }(this._root)
        }
        ,
        e.prototype.load = function(e, t, n) {
            void 0 === t && (t = []),
            void 0 === n && (n = !1);
            var i = e.length
              , r = this._comparator;
            if (n && on(e, t, 0, i - 1, r),
            null === this._root)
                this._root = nn(e, t, 0, i),
                this._size = i;
            else {
                var o = function(e, t, n) {
                    var i = new Ht(null,null)
                      , r = i
                      , o = e
                      , s = t;
                    for (; null !== o && null !== s; )
                        0 > n(o.key, s.key) ? (r.next = o,
                        o = o.next) : (r.next = s,
                        s = s.next),
                        r = r.next;
                    null !== o ? r.next = o : null !== s && (r.next = s);
                    return i.next
                }(this.toList(), function(e, t) {
                    for (var n = new Ht(null,null), i = n, r = 0; e.length > r; r++)
                        i = i.next = new Ht(e[r],t[r]);
                    return i.next = null,
                    n.next
                }(e, t), r);
                this._root = rn({
                    head: o
                }, 0, i = this._size + i)
            }
            return this
        }
        ,
        e.prototype.isEmpty = function() {
            return null === this._root
        }
        ,
        Object.defineProperty(e.prototype, "size", {
            get: function() {
                return this._size
            },
            enumerable: !0,
            configurable: !0
        }),
        Object.defineProperty(e.prototype, "root", {
            get: function() {
                return this._root
            },
            enumerable: !0,
            configurable: !0
        }),
        e.prototype.toString = function(e) {
            void 0 === e && (e = function(e) {
                return e.key + ""
            }
            );
            var t = [];
            return en(this._root, "", !0, (function(e) {
                return t.push(e)
            }
            ), e),
            t.join("")
        }
        ,
        e.prototype.update = function(e, t, n) {
            var i = this._comparator
              , r = $t(e, this._root, i)
              , o = r.left
              , s = r.right;
            0 > i(e, t) ? s = qt(t, n, s, i) : o = qt(t, n, o, i),
            this._root = function(e, t, n) {
                return null === t ? e : (null === e || ((t = Zt(e.key, t, n)).left = e),
                t)
            }(o, s, i)
        }
        ,
        e.prototype.split = function(e) {
            return $t(e, this._root, this._comparator)
        }
        ,
        e.prototype[Symbol.iterator] = function() {
            var e, t, n;
            return Qt(this, (function(i) {
                switch (i.label) {
                case 0:
                    e = this._root,
                    t = [],
                    n = !1,
                    i.label = 1;
                case 1:
                    return n ? [3, 6] : null === e ? [3, 2] : (t.push(e),
                    e = e.left,
                    [3, 5]);
                case 2:
                    return 0 === t.length ? [3, 4] : [4, e = t.pop()];
                case 3:
                    return i.sent(),
                    e = e.right,
                    [3, 5];
                case 4:
                    n = !0,
                    i.label = 5;
                case 5:
                    return [3, 1];
                case 6:
                    return [2]
                }
            }
            ))
        }
        ,
        e
    }();
    function nn(e, t, n, i) {
        var r = i - n;
        if (r > 0) {
            var o = n + Math.floor(r / 2)
              , s = new Ht(e[o],t[o]);
            return s.left = nn(e, t, n, o),
            s.right = nn(e, t, o + 1, i),
            s
        }
        return null
    }
    function rn(e, t, n) {
        var i = n - t;
        if (i > 0) {
            var r = t + Math.floor(i / 2)
              , o = rn(e, t, r)
              , s = e.head;
            return s.left = o,
            e.head = e.head.next,
            s.right = rn(e, r + 1, n),
            s
        }
        return null
    }
    function on(e, t, n, i, r) {
        if (i > n) {
            for (var o = e[n + i >> 1], s = n - 1, a = i + 1; ; ) {
                do {
                    s++
                } while (0 > r(e[s], o));
                do {
                    a--
                } while (r(e[a], o) > 0);
                if (s >= a)
                    break;
                var l = e[s];
                e[s] = e[a],
                e[a] = l,
                l = t[s],
                t[s] = t[a],
                t[a] = l
            }
            on(e, t, n, a, r),
            on(e, t, a + 1, i, r)
        }
    }
    const sn = 11102230246251565e-32
      , an = 134217729
      , ln = (3 + 8 * sn) * sn;
    function hn(e, t, n, i, r) {
        let o, s, a, l, h = t[0], c = i[0], u = 0, p = 0;
        c > h == c > -h ? (o = h,
        h = t[++u]) : (o = c,
        c = i[++p]);
        let v = 0;
        if (e > u && n > p)
            for (c > h == c > -h ? (s = h + o,
            a = o - (s - h),
            h = t[++u]) : (s = c + o,
            a = o - (s - c),
            c = i[++p]),
            o = s,
            0 !== a && (r[v++] = a); e > u && n > p; )
                c > h == c > -h ? (s = o + h,
                l = s - o,
                a = o - (s - l) + (h - l),
                h = t[++u]) : (s = o + c,
                l = s - o,
                a = o - (s - l) + (c - l),
                c = i[++p]),
                o = s,
                0 !== a && (r[v++] = a);
        for (; e > u; )
            s = o + h,
            l = s - o,
            a = o - (s - l) + (h - l),
            h = t[++u],
            o = s,
            0 !== a && (r[v++] = a);
        for (; n > p; )
            s = o + c,
            l = s - o,
            a = o - (s - l) + (c - l),
            c = i[++p],
            o = s,
            0 !== a && (r[v++] = a);
        return 0 === o && 0 !== v || (r[v++] = o),
        v
    }
    function cn(e) {
        return new Float64Array(e)
    }
    const un = 22204460492503146e-32
      , pn = 11093356479670487e-47
      , vn = cn(4)
      , dn = cn(8)
      , fn = cn(12)
      , gn = cn(16)
      , mn = cn(4);
    function yn(e, t, n, i, r, o) {
        const s = (t - o) * (n - r)
          , a = (e - r) * (i - o)
          , l = s - a
          , h = Math.abs(s + a);
        return 33306690738754716e-32 * h > Math.abs(l) ? -function(e, t, n, i, r, o, s) {
            let a, l, h, c, u, p, v, d, f, g, m, y, b, w, E, k, M, L;
            const x = e - r
              , O = n - r
              , S = t - o
              , A = i - o;
            w = x * A,
            p = an * x,
            v = p - (p - x),
            d = x - v,
            p = an * A,
            f = p - (p - A),
            g = A - f,
            E = d * g - (w - v * f - d * f - v * g),
            k = S * O,
            p = an * S,
            v = p - (p - S),
            d = S - v,
            p = an * O,
            f = p - (p - O),
            g = O - f,
            M = d * g - (k - v * f - d * f - v * g),
            m = E - M,
            u = E - m,
            vn[0] = E - (m + u) + (u - M),
            y = w + m,
            u = y - w,
            b = w - (y - u) + (m - u),
            m = b - k,
            u = b - m,
            vn[1] = b - (m + u) + (u - k),
            L = y + m,
            u = L - y,
            vn[2] = y - (L - u) + (m - u),
            vn[3] = L;
            let P = function(e, t) {
                let n = t[0];
                for (let i = 1; e > i; i++)
                    n += t[i];
                return n
            }(4, vn)
              , B = un * s;
            if (P >= B || -P >= B)
                return P;
            if (u = e - x,
            a = e - (x + u) + (u - r),
            u = n - O,
            h = n - (O + u) + (u - r),
            u = t - S,
            l = t - (S + u) + (u - o),
            u = i - A,
            c = i - (A + u) + (u - o),
            0 === a && 0 === l && 0 === h && 0 === c)
                return P;
            if (B = pn * s + ln * Math.abs(P),
            P += x * c + A * a - (S * h + O * l),
            P >= B || -P >= B)
                return P;
            w = a * A,
            p = an * a,
            v = p - (p - a),
            d = a - v,
            p = an * A,
            f = p - (p - A),
            g = A - f,
            E = d * g - (w - v * f - d * f - v * g),
            k = l * O,
            p = an * l,
            v = p - (p - l),
            d = l - v,
            p = an * O,
            f = p - (p - O),
            g = O - f,
            M = d * g - (k - v * f - d * f - v * g),
            m = E - M,
            u = E - m,
            mn[0] = E - (m + u) + (u - M),
            y = w + m,
            u = y - w,
            b = w - (y - u) + (m - u),
            m = b - k,
            u = b - m,
            mn[1] = b - (m + u) + (u - k),
            L = y + m,
            u = L - y,
            mn[2] = y - (L - u) + (m - u),
            mn[3] = L;
            const G = hn(4, vn, 4, mn, dn);
            w = x * c,
            p = an * x,
            v = p - (p - x),
            d = x - v,
            p = an * c,
            f = p - (p - c),
            g = c - f,
            E = d * g - (w - v * f - d * f - v * g),
            k = S * h,
            p = an * S,
            v = p - (p - S),
            d = S - v,
            p = an * h,
            f = p - (p - h),
            g = h - f,
            M = d * g - (k - v * f - d * f - v * g),
            m = E - M,
            u = E - m,
            mn[0] = E - (m + u) + (u - M),
            y = w + m,
            u = y - w,
            b = w - (y - u) + (m - u),
            m = b - k,
            u = b - m,
            mn[1] = b - (m + u) + (u - k),
            L = y + m,
            u = L - y,
            mn[2] = y - (L - u) + (m - u),
            mn[3] = L;
            const C = hn(G, dn, 4, mn, fn);
            w = a * c,
            p = an * a,
            v = p - (p - a),
            d = a - v,
            p = an * c,
            f = p - (p - c),
            g = c - f,
            E = d * g - (w - v * f - d * f - v * g),
            k = l * h,
            p = an * l,
            v = p - (p - l),
            d = l - v,
            p = an * h,
            f = p - (p - h),
            g = h - f,
            M = d * g - (k - v * f - d * f - v * g),
            m = E - M,
            u = E - m,
            mn[0] = E - (m + u) + (u - M),
            y = w + m,
            u = y - w,
            b = w - (y - u) + (m - u),
            m = b - k,
            u = b - m,
            mn[1] = b - (m + u) + (u - k),
            L = y + m,
            u = L - y,
            mn[2] = y - (L - u) + (m - u),
            mn[3] = L;
            const I = hn(C, fn, 4, mn, gn);
            return gn[I - 1]
        }(e, t, n, i, r, o, h) : l
    }
    const bn = (e, t) => !(e.ll.x > t.x || t.x > e.ur.x || e.ll.y > t.y || t.y > e.ur.y)
      , wn = (e, t) => {
        if (e.ll.x > t.ur.x || t.ll.x > e.ur.x || e.ll.y > t.ur.y || t.ll.y > e.ur.y)
            return null;
        return {
            ll: {
                x: t.ll.x > e.ll.x ? t.ll.x : e.ll.x,
                y: t.ll.y > e.ll.y ? t.ll.y : e.ll.y
            },
            ur: {
                x: t.ur.x > e.ur.x ? e.ur.x : t.ur.x,
                y: t.ur.y > e.ur.y ? e.ur.y : t.ur.y
            }
        }
    }
    ;
    let En = Number.EPSILON;
    void 0 === En && (En = Math.pow(2, -52));
    const kn = En * En
      , Mn = (e, t) => {
        if (e > -En && En > e && t > -En && En > t)
            return 0;
        const n = e - t;
        return kn * e * t > n * n ? 0 : t > e ? -1 : 1
    }
    ;
    class Ln {
        constructor() {
            this.tree = new tn,
            this.round(0)
        }
        round(e) {
            const t = this.tree.add(e)
              , n = this.tree.prev(t);
            if (null !== n && 0 === Mn(t.key, n.key))
                return this.tree.remove(e),
                n.key;
            const i = this.tree.next(t);
            return null !== i && 0 === Mn(t.key, i.key) ? (this.tree.remove(e),
            i.key) : e
        }
    }
    const xn = new class {
        constructor() {
            this.reset()
        }
        reset() {
            this.xRounder = new Ln,
            this.yRounder = new Ln
        }
        round(e, t) {
            return {
                x: this.xRounder.round(e),
                y: this.yRounder.round(t)
            }
        }
    }
      , On = (e, t) => e.x * t.y - e.y * t.x
      , Sn = (e, t) => e.x * t.x + e.y * t.y
      , An = (e, t, n) => {
        const i = yn(e.x, e.y, t.x, t.y, n.x, n.y);
        return i > 0 ? -1 : 0 > i ? 1 : 0
    }
      , Pn = e => Math.sqrt(Sn(e, e))
      , Bn = (e, t, n) => {
        const i = {
            x: t.x - e.x,
            y: t.y - e.y
        }
          , r = {
            x: n.x - e.x,
            y: n.y - e.y
        };
        return On(r, i) / Pn(r) / Pn(i)
    }
      , Gn = (e, t, n) => {
        const i = {
            x: t.x - e.x,
            y: t.y - e.y
        }
          , r = {
            x: n.x - e.x,
            y: n.y - e.y
        };
        return Sn(r, i) / Pn(r) / Pn(i)
    }
      , Cn = (e, t, n) => 0 === t.y ? null : {
        x: e.x + t.x / t.y * (n - e.y),
        y: n
    }
      , In = (e, t, n) => 0 === t.x ? null : {
        x: n,
        y: e.y + t.y / t.x * (n - e.x)
    };
    class Rn {
        static compare(e, t) {
            const n = Rn.comparePoints(e.point, t.point);
            return 0 !== n ? n : (e.point !== t.point && e.link(t),
            e.isLeft !== t.isLeft ? e.isLeft ? 1 : -1 : Dn.compare(e.segment, t.segment))
        }
        static comparePoints(e, t) {
            return t.x > e.x ? -1 : e.x > t.x ? 1 : t.y > e.y ? -1 : e.y > t.y ? 1 : 0
        }
        constructor(e, t) {
            void 0 === e.events ? e.events = [this] : e.events.push(this),
            this.point = e,
            this.isLeft = t
        }
        link(e) {
            if (e.point === this.point)
                throw Error("Tried to link already linked events");
            const t = e.point.events;
            for (let e = 0, n = t.length; n > e; e++) {
                const n = t[e];
                this.point.events.push(n),
                n.point = this.point
            }
            this.checkForConsuming()
        }
        checkForConsuming() {
            const e = this.point.events.length;
            for (let t = 0; e > t; t++) {
                const n = this.point.events[t];
                if (void 0 === n.segment.consumedBy)
                    for (let i = t + 1; e > i; i++) {
                        const e = this.point.events[i];
                        void 0 === e.consumedBy && (n.otherSE.point.events === e.otherSE.point.events && n.segment.consume(e.segment))
                    }
            }
        }
        getAvailableLinkedEvents() {
            const e = [];
            for (let t = 0, n = this.point.events.length; n > t; t++) {
                const n = this.point.events[t];
                n !== this && !n.segment.ringOut && n.segment.isInResult() && e.push(n)
            }
            return e
        }
        getLeftmostComparator(e) {
            const t = new Map
              , n = n => {
                const i = n.otherSE;
                t.set(n, {
                    sine: Bn(this.point, e.point, i.point),
                    cosine: Gn(this.point, e.point, i.point)
                })
            }
            ;
            return (e, i) => {
                t.has(e) || n(e),
                t.has(i) || n(i);
                const {sine: r, cosine: o} = t.get(e)
                  , {sine: s, cosine: a} = t.get(i);
                return 0 > r || 0 > s ? 0 > r && 0 > s ? a > o ? -1 : o > a ? 1 : 0 : r > s ? -1 : s > r ? 1 : 0 : a > o ? 1 : o > a ? -1 : 0
            }
        }
    }
    let Nn = 0;
    class Dn {
        static compare(e, t) {
            const n = e.leftSE.point.x
              , i = t.leftSE.point.x
              , r = e.rightSE.point.x
              , o = t.rightSE.point.x;
            if (n > o)
                return 1;
            if (i > r)
                return -1;
            const s = e.leftSE.point.y
              , a = t.leftSE.point.y
              , l = e.rightSE.point.y
              , h = t.rightSE.point.y;
            if (i > n) {
                if (s > a && l > a)
                    return 1;
                if (a > s && a > l)
                    return -1;
                const n = e.comparePoint(t.leftSE.point);
                if (0 > n)
                    return 1;
                if (n > 0)
                    return -1;
                const i = t.comparePoint(e.rightSE.point);
                return 0 !== i ? i : -1
            }
            if (n > i) {
                if (a > s && h > s)
                    return -1;
                if (s > a && s > h)
                    return 1;
                const n = t.comparePoint(e.leftSE.point);
                if (0 !== n)
                    return n;
                const i = e.comparePoint(t.rightSE.point);
                return 0 > i ? 1 : i > 0 ? -1 : 1
            }
            if (a > s)
                return -1;
            if (s > a)
                return 1;
            if (o > r) {
                const n = t.comparePoint(e.rightSE.point);
                if (0 !== n)
                    return n
            }
            if (r > o) {
                const n = e.comparePoint(t.rightSE.point);
                if (0 > n)
                    return 1;
                if (n > 0)
                    return -1
            }
            if (r !== o) {
                const e = l - s
                  , t = r - n
                  , c = h - a
                  , u = o - i;
                if (e > t && u > c)
                    return 1;
                if (t > e && c > u)
                    return -1
            }
            return r > o ? 1 : o > r || h > l ? -1 : l > h ? 1 : t.id > e.id ? -1 : e.id > t.id ? 1 : 0
        }
        constructor(e, t, n, i) {
            this.id = ++Nn,
            this.leftSE = e,
            e.segment = this,
            e.otherSE = t,
            this.rightSE = t,
            t.segment = this,
            t.otherSE = e,
            this.rings = n,
            this.windings = i
        }
        static fromRing(e, t, n) {
            let i, r, o;
            const s = Rn.comparePoints(e, t);
            if (0 > s)
                i = e,
                r = t,
                o = 1;
            else {
                if (0 >= s)
                    throw Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);
                i = t,
                r = e,
                o = -1
            }
            const a = new Rn(i,!0)
              , l = new Rn(r,!1);
            return new Dn(a,l,[n],[o])
        }
        replaceRightSE(e) {
            this.rightSE = e,
            this.rightSE.segment = this,
            this.rightSE.otherSE = this.leftSE,
            this.leftSE.otherSE = this.rightSE
        }
        bbox() {
            const e = this.leftSE.point.y
              , t = this.rightSE.point.y;
            return {
                ll: {
                    x: this.leftSE.point.x,
                    y: t > e ? e : t
                },
                ur: {
                    x: this.rightSE.point.x,
                    y: e > t ? e : t
                }
            }
        }
        vector() {
            return {
                x: this.rightSE.point.x - this.leftSE.point.x,
                y: this.rightSE.point.y - this.leftSE.point.y
            }
        }
        isAnEndpoint(e) {
            return e.x === this.leftSE.point.x && e.y === this.leftSE.point.y || e.x === this.rightSE.point.x && e.y === this.rightSE.point.y
        }
        comparePoint(e) {
            if (this.isAnEndpoint(e))
                return 0;
            const t = this.leftSE.point
              , n = this.rightSE.point
              , i = this.vector();
            if (t.x === n.x)
                return e.x === t.x ? 0 : t.x > e.x ? 1 : -1;
            if (e.x === t.x + (e.y - t.y) / i.y * i.x)
                return 0;
            const r = t.y + (e.x - t.x) / i.x * i.y;
            return e.y === r ? 0 : r > e.y ? -1 : 1
        }
        getIntersection(e) {
            const t = this.bbox()
              , n = e.bbox()
              , i = wn(t, n);
            if (null === i)
                return null;
            const r = this.leftSE.point
              , o = this.rightSE.point
              , s = e.leftSE.point
              , a = e.rightSE.point
              , l = bn(t, s) && 0 === this.comparePoint(s)
              , h = bn(n, r) && 0 === e.comparePoint(r)
              , c = bn(t, a) && 0 === this.comparePoint(a)
              , u = bn(n, o) && 0 === e.comparePoint(o);
            if (h && l)
                return u && !c ? o : !u && c ? a : null;
            if (h)
                return c && r.x === a.x && r.y === a.y ? null : r;
            if (l)
                return u && o.x === s.x && o.y === s.y ? null : s;
            if (u && c)
                return null;
            if (u)
                return o;
            if (c)
                return a;
            const p = ( (e, t, n, i) => {
                if (0 === t.x)
                    return In(n, i, e.x);
                if (0 === i.x)
                    return In(e, t, n.x);
                if (0 === t.y)
                    return Cn(n, i, e.y);
                if (0 === i.y)
                    return Cn(e, t, n.y);
                const r = On(t, i);
                if (0 == r)
                    return null;
                const o = {
                    x: n.x - e.x,
                    y: n.y - e.y
                }
                  , s = On(o, t) / r
                  , a = On(o, i) / r;
                return {
                    x: (e.x + a * t.x + (n.x + s * i.x)) / 2,
                    y: (e.y + a * t.y + (n.y + s * i.y)) / 2
                }
            }
            )(r, this.vector(), s, e.vector());
            return null === p ? null : bn(i, p) ? xn.round(p.x, p.y) : null
        }
        split(e) {
            const t = []
              , n = void 0 !== e.events
              , i = new Rn(e,!0)
              , r = new Rn(e,!1)
              , o = this.rightSE;
            this.replaceRightSE(r),
            t.push(r),
            t.push(i);
            const s = new Dn(i,o,this.rings.slice(),this.windings.slice());
            return Rn.comparePoints(s.leftSE.point, s.rightSE.point) > 0 && s.swapEvents(),
            Rn.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(),
            n && (i.checkForConsuming(),
            r.checkForConsuming()),
            t
        }
        swapEvents() {
            const e = this.rightSE;
            this.rightSE = this.leftSE,
            this.leftSE = e,
            this.leftSE.isLeft = !0,
            this.rightSE.isLeft = !1;
            for (let e = 0, t = this.windings.length; t > e; e++)
                this.windings[e] *= -1
        }
        consume(e) {
            let t = this
              , n = e;
            for (; t.consumedBy; )
                t = t.consumedBy;
            for (; n.consumedBy; )
                n = n.consumedBy;
            const i = Dn.compare(t, n);
            if (0 !== i) {
                if (i > 0) {
                    const e = t;
                    t = n,
                    n = e
                }
                if (t.prev === n) {
                    const e = t;
                    t = n,
                    n = e
                }
                for (let e = 0, i = n.rings.length; i > e; e++) {
                    const i = n.rings[e]
                      , r = n.windings[e]
                      , o = t.rings.indexOf(i);
                    -1 === o ? (t.rings.push(i),
                    t.windings.push(r)) : t.windings[o] += r
                }
                n.rings = null,
                n.windings = null,
                n.consumedBy = t,
                n.leftSE.consumedBy = t.leftSE,
                n.rightSE.consumedBy = t.rightSE
            }
        }
        prevInResult() {
            return void 0 !== this._prevInResult || (this._prevInResult = this.prev ? this.prev.isInResult() ? this.prev : this.prev.prevInResult() : null),
            this._prevInResult
        }
        beforeState() {
            if (void 0 !== this._beforeState)
                return this._beforeState;
            if (this.prev) {
                this._beforeState = (this.prev.consumedBy || this.prev).afterState()
            } else
                this._beforeState = {
                    rings: [],
                    windings: [],
                    multiPolys: []
                };
            return this._beforeState
        }
        afterState() {
            if (void 0 !== this._afterState)
                return this._afterState;
            const e = this.beforeState();
            this._afterState = {
                rings: e.rings.slice(0),
                windings: e.windings.slice(0),
                multiPolys: []
            };
            const t = this._afterState.rings
              , n = this._afterState.windings
              , i = this._afterState.multiPolys;
            for (let e = 0, i = this.rings.length; i > e; e++) {
                const i = this.rings[e]
                  , r = this.windings[e]
                  , o = t.indexOf(i);
                -1 === o ? (t.push(i),
                n.push(r)) : n[o] += r
            }
            const r = []
              , o = [];
            for (let e = 0, i = t.length; i > e; e++) {
                if (0 === n[e])
                    continue;
                const i = t[e]
                  , s = i.poly;
                if (-1 === o.indexOf(s))
                    if (i.isExterior)
                        r.push(s);
                    else {
                        -1 === o.indexOf(s) && o.push(s);
                        const e = r.indexOf(i.poly);
                        -1 !== e && r.splice(e, 1)
                    }
            }
            for (let e = 0, t = r.length; t > e; e++) {
                const t = r[e].multiPoly;
                -1 === i.indexOf(t) && i.push(t)
            }
            return this._afterState
        }
        isInResult() {
            if (this.consumedBy)
                return !1;
            if (void 0 !== this._isInResult)
                return this._isInResult;
            const e = this.beforeState().multiPolys
              , t = this.afterState().multiPolys;
            switch (Xn.type) {
            case "union":
                this._isInResult = 0 === e.length !== (0 === t.length);
                break;
            case "intersection":
                {
                    let n, i;
                    t.length > e.length ? (n = e.length,
                    i = t.length) : (n = t.length,
                    i = e.length),
                    this._isInResult = i === Xn.numMultiPolys && i > n;
                    break
                }
            case "xor":
                this._isInResult = Math.abs(e.length - t.length) % 2 == 1;
                break;
            case "difference":
                {
                    const n = e => 1 === e.length && e[0].isSubject;
                    this._isInResult = n(e) !== n(t);
                    break
                }
            default:
                throw Error("Unrecognized operation type found " + Xn.type)
            }
            return this._isInResult
        }
    }
    class _n {
        constructor(e, t, n) {
            if (!Array.isArray(e) || 0 === e.length)
                throw Error("Input geometry is not a valid Polygon or MultiPolygon");
            if (this.poly = t,
            this.isExterior = n,
            this.segments = [],
            "number" != typeof e[0][0] || "number" != typeof e[0][1])
                throw Error("Input geometry is not a valid Polygon or MultiPolygon");
            const i = xn.round(e[0][0], e[0][1]);
            this.bbox = {
                ll: {
                    x: i.x,
                    y: i.y
                },
                ur: {
                    x: i.x,
                    y: i.y
                }
            };
            let r = i;
            for (let t = 1, n = e.length; n > t; t++) {
                if ("number" != typeof e[t][0] || "number" != typeof e[t][1])
                    throw Error("Input geometry is not a valid Polygon or MultiPolygon");
                let n = xn.round(e[t][0], e[t][1]);
                n.x === r.x && n.y === r.y || (this.segments.push(Dn.fromRing(r, n, this)),
                this.bbox.ll.x > n.x && (this.bbox.ll.x = n.x),
                this.bbox.ll.y > n.y && (this.bbox.ll.y = n.y),
                n.x > this.bbox.ur.x && (this.bbox.ur.x = n.x),
                n.y > this.bbox.ur.y && (this.bbox.ur.y = n.y),
                r = n)
            }
            i.x === r.x && i.y === r.y || this.segments.push(Dn.fromRing(r, i, this))
        }
        getSweepEvents() {
            const e = [];
            for (let t = 0, n = this.segments.length; n > t; t++) {
                const n = this.segments[t];
                e.push(n.leftSE),
                e.push(n.rightSE)
            }
            return e
        }
    }
    class Tn {
        constructor(e, t) {
            if (!Array.isArray(e))
                throw Error("Input geometry is not a valid Polygon or MultiPolygon");
            this.exteriorRing = new _n(e[0],this,!0),
            this.bbox = {
                ll: {
                    x: this.exteriorRing.bbox.ll.x,
                    y: this.exteriorRing.bbox.ll.y
                },
                ur: {
                    x: this.exteriorRing.bbox.ur.x,
                    y: this.exteriorRing.bbox.ur.y
                }
            },
            this.interiorRings = [];
            for (let t = 1, n = e.length; n > t; t++) {
                const n = new _n(e[t],this,!1);
                this.bbox.ll.x > n.bbox.ll.x && (this.bbox.ll.x = n.bbox.ll.x),
                this.bbox.ll.y > n.bbox.ll.y && (this.bbox.ll.y = n.bbox.ll.y),
                n.bbox.ur.x > this.bbox.ur.x && (this.bbox.ur.x = n.bbox.ur.x),
                n.bbox.ur.y > this.bbox.ur.y && (this.bbox.ur.y = n.bbox.ur.y),
                this.interiorRings.push(n)
            }
            this.multiPoly = t
        }
        getSweepEvents() {
            const e = this.exteriorRing.getSweepEvents();
            for (let t = 0, n = this.interiorRings.length; n > t; t++) {
                const n = this.interiorRings[t].getSweepEvents();
                for (let t = 0, i = n.length; i > t; t++)
                    e.push(n[t])
            }
            return e
        }
    }
    class Fn {
        constructor(e, t) {
            if (!Array.isArray(e))
                throw Error("Input geometry is not a valid Polygon or MultiPolygon");
            try {
                "number" == typeof e[0][0][0] && (e = [e])
            } catch (e) {}
            this.polys = [],
            this.bbox = {
                ll: {
                    x: 1 / 0,
                    y: 1 / 0
                },
                ur: {
                    x: -1 / 0,
                    y: -1 / 0
                }
            };
            for (let t = 0, n = e.length; n > t; t++) {
                const n = new Tn(e[t],this);
                this.bbox.ll.x > n.bbox.ll.x && (this.bbox.ll.x = n.bbox.ll.x),
                this.bbox.ll.y > n.bbox.ll.y && (this.bbox.ll.y = n.bbox.ll.y),
                n.bbox.ur.x > this.bbox.ur.x && (this.bbox.ur.x = n.bbox.ur.x),
                n.bbox.ur.y > this.bbox.ur.y && (this.bbox.ur.y = n.bbox.ur.y),
                this.polys.push(n)
            }
            this.isSubject = t
        }
        getSweepEvents() {
            const e = [];
            for (let t = 0, n = this.polys.length; n > t; t++) {
                const n = this.polys[t].getSweepEvents();
                for (let t = 0, i = n.length; i > t; t++)
                    e.push(n[t])
            }
            return e
        }
    }
    class Wn {
        static factory(e) {
            const t = [];
            for (let n = 0, i = e.length; i > n; n++) {
                const i = e[n];
                if (!i.isInResult() || i.ringOut)
                    continue;
                let r = null
                  , o = i.leftSE
                  , s = i.rightSE;
                const a = [o]
                  , l = o.point
                  , h = [];
                for (; r = o,
                o = s,
                a.push(o),
                o.point !== l; )
                    for (; ; ) {
                        const e = o.getAvailableLinkedEvents();
                        if (0 === e.length) {
                            const e = a[0].point
                              , t = a[a.length - 1].point;
                            throw Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)
                        }
                        if (1 === e.length) {
                            s = e[0].otherSE;
                            break
                        }
                        let n = null;
                        for (let e = 0, t = h.length; t > e; e++)
                            if (h[e].point === o.point) {
                                n = e;
                                break
                            }
                        if (null !== n) {
                            const e = h.splice(n)[0]
                              , i = a.splice(e.index);
                            i.unshift(i[0].otherSE),
                            t.push(new Wn(i.reverse()));
                            continue
                        }
                        h.push({
                            index: a.length,
                            point: o.point
                        });
                        const i = o.getLeftmostComparator(r);
                        s = e.sort(i)[0].otherSE;
                        break
                    }
                t.push(new Wn(a))
            }
            return t
        }
        constructor(e) {
            this.events = e;
            for (let t = 0, n = e.length; n > t; t++)
                e[t].segment.ringOut = this;
            this.poly = null
        }
        getGeom() {
            let e = this.events[0].point;
            const t = [e];
            for (let n = 1, i = this.events.length - 1; i > n; n++) {
                const i = this.events[n].point;
                0 !== An(i, e, this.events[n + 1].point) && (t.push(i),
                e = i)
            }
            if (1 === t.length)
                return null;
            0 === An(t[0], e, t[1]) && t.shift(),
            t.push(t[0]);
            const n = this.isExteriorRing() ? 1 : -1
              , i = this.isExteriorRing() ? 0 : t.length - 1
              , r = this.isExteriorRing() ? t.length : -1
              , o = [];
            for (let e = i; e != r; e += n)
                o.push([t[e].x, t[e].y]);
            return o
        }
        isExteriorRing() {
            if (void 0 === this._isExteriorRing) {
                const e = this.enclosingRing();
                this._isExteriorRing = !e || !e.isExteriorRing()
            }
            return this._isExteriorRing
        }
        enclosingRing() {
            return void 0 === this._enclosingRing && (this._enclosingRing = this._calcEnclosingRing()),
            this._enclosingRing
        }
        _calcEnclosingRing() {
            let e = this.events[0];
            for (let t = 1, n = this.events.length; n > t; t++) {
                const n = this.events[t];
                Rn.compare(e, n) > 0 && (e = n)
            }
            let t = e.segment.prevInResult()
              , n = t ? t.prevInResult() : null;
            for (; ; ) {
                if (!t)
                    return null;
                if (!n)
                    return t.ringOut;
                if (n.ringOut !== t.ringOut)
                    return n.ringOut.enclosingRing() !== t.ringOut ? t.ringOut : t.ringOut.enclosingRing();
                t = n.prevInResult(),
                n = t ? t.prevInResult() : null
            }
        }
    }
    class zn {
        constructor(e) {
            this.exteriorRing = e,
            e.poly = this,
            this.interiorRings = []
        }
        addInterior(e) {
            this.interiorRings.push(e),
            e.poly = this
        }
        getGeom() {
            const e = [this.exteriorRing.getGeom()];
            if (null === e[0])
                return null;
            for (let t = 0, n = this.interiorRings.length; n > t; t++) {
                const n = this.interiorRings[t].getGeom();
                null !== n && e.push(n)
            }
            return e
        }
    }
    class jn {
        constructor(e) {
            this.rings = e,
            this.polys = this._composePolys(e)
        }
        getGeom() {
            const e = [];
            for (let t = 0, n = this.polys.length; n > t; t++) {
                const n = this.polys[t].getGeom();
                null !== n && e.push(n)
            }
            return e
        }
        _composePolys(e) {
            const t = [];
            for (let n = 0, i = e.length; i > n; n++) {
                const i = e[n];
                if (!i.poly)
                    if (i.isExteriorRing())
                        t.push(new zn(i));
                    else {
                        const e = i.enclosingRing();
                        e.poly || t.push(new zn(e)),
                        e.poly.addInterior(i)
                    }
            }
            return t
        }
    }
    class Un {
        constructor(e) {
            let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Dn.compare;
            this.queue = e,
            this.tree = new tn(t),
            this.segments = []
        }
        process(e) {
            const t = e.segment
              , n = [];
            if (e.consumedBy)
                return e.isLeft ? this.queue.remove(e.otherSE) : this.tree.remove(t),
                n;
            const i = e.isLeft ? this.tree.add(t) : this.tree.find(t);
            if (!i)
                throw Error(`Unable to find segment #${t.id} [${t.leftSE.point.x}, ${t.leftSE.point.y}] -> [${t.rightSE.point.x}, ${t.rightSE.point.y}] in SweepLine tree.`);
            let r, o, s = i, a = i;
            for (; void 0 === r; )
                s = this.tree.prev(s),
                null === s ? r = null : void 0 === s.key.consumedBy && (r = s.key);
            for (; void 0 === o; )
                a = this.tree.next(a),
                null === a ? o = null : void 0 === a.key.consumedBy && (o = a.key);
            if (e.isLeft) {
                let i = null;
                if (r) {
                    const e = r.getIntersection(t);
                    if (null !== e && (t.isAnEndpoint(e) || (i = e),
                    !r.isAnEndpoint(e))) {
                        const t = this._splitSafely(r, e);
                        for (let e = 0, i = t.length; i > e; e++)
                            n.push(t[e])
                    }
                }
                let s = null;
                if (o) {
                    const e = o.getIntersection(t);
                    if (null !== e && (t.isAnEndpoint(e) || (s = e),
                    !o.isAnEndpoint(e))) {
                        const t = this._splitSafely(o, e);
                        for (let e = 0, i = t.length; i > e; e++)
                            n.push(t[e])
                    }
                }
                if (null !== i || null !== s) {
                    let e = null;
                    if (null === i)
                        e = s;
                    else if (null === s)
                        e = i;
                    else {
                        e = Rn.comparePoints(i, s) > 0 ? s : i
                    }
                    this.queue.remove(t.rightSE),
                    n.push(t.rightSE);
                    const r = t.split(e);
                    for (let e = 0, t = r.length; t > e; e++)
                        n.push(r[e])
                }
                n.length > 0 ? (this.tree.remove(t),
                n.push(e)) : (this.segments.push(t),
                t.prev = r)
            } else {
                if (r && o) {
                    const e = r.getIntersection(o);
                    if (null !== e) {
                        if (!r.isAnEndpoint(e)) {
                            const t = this._splitSafely(r, e);
                            for (let e = 0, i = t.length; i > e; e++)
                                n.push(t[e])
                        }
                        if (!o.isAnEndpoint(e)) {
                            const t = this._splitSafely(o, e);
                            for (let e = 0, i = t.length; i > e; e++)
                                n.push(t[e])
                        }
                    }
                }
                this.tree.remove(t)
            }
            return n
        }
        _splitSafely(e, t) {
            this.tree.remove(e);
            const n = e.rightSE;
            this.queue.remove(n);
            const i = e.split(t);
            return i.push(n),
            void 0 === e.consumedBy && this.tree.add(e),
            i
        }
    }
    const Yn = "undefined" != typeof process && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6
      , Jn = "undefined" != typeof process && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
    const Xn = new class {
        run(e, t, n) {
            Xn.type = e,
            xn.reset();
            const i = [new Fn(t,!0)];
            for (let e = 0, t = n.length; t > e; e++)
                i.push(new Fn(n[e],!1));
            if (Xn.numMultiPolys = i.length,
            "difference" === Xn.type) {
                const e = i[0];
                let t = 1;
                for (; i.length > t; )
                    null !== wn(i[t].bbox, e.bbox) ? t++ : i.splice(t, 1)
            }
            if ("intersection" === Xn.type)
                for (let e = 0, t = i.length; t > e; e++) {
                    const t = i[e];
                    for (let n = e + 1, r = i.length; r > n; n++)
                        if (null === wn(t.bbox, i[n].bbox))
                            return []
                }
            const r = new tn(Rn.compare);
            for (let e = 0, t = i.length; t > e; e++) {
                const t = i[e].getSweepEvents();
                for (let e = 0, n = t.length; n > e; e++)
                    if (r.insert(t[e]),
                    r.size > Yn)
                        throw Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")
            }
            const o = new Un(r);
            let s = r.size
              , a = r.pop();
            for (; a; ) {
                const e = a.key;
                if (r.size === s) {
                    const t = e.segment;
                    throw Error(`Unable to pop() ${e.isLeft ? "left" : "right"} SweepEvent [${e.point.x}, ${e.point.y}] from segment #${t.id} [${t.leftSE.point.x}, ${t.leftSE.point.y}] -> [${t.rightSE.point.x}, ${t.rightSE.point.y}] from queue.`)
                }
                if (r.size > Yn)
                    throw Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
                if (o.segments.length > Jn)
                    throw Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
                const t = o.process(e);
                for (let e = 0, n = t.length; n > e; e++) {
                    const n = t[e];
                    void 0 === n.consumedBy && r.insert(n)
                }
                s = r.size,
                a = r.pop()
            }
            xn.reset();
            const l = Wn.factory(o.segments);
            return new jn(l).getGeom()
        }
    }
    ;
    var Vn = function(e) {
        for (var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), i = 1; t > i; i++)
            n[i - 1] = arguments[i];
        return Xn.run("union", e, n)
    }
      , Qn = function(e) {
        for (var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), i = 1; t > i; i++)
            n[i - 1] = arguments[i];
        return Xn.run("difference", e, n)
    };
    function Hn(e, t, n) {
        void 0 === n && (n = {});
        var i = Me(e)
          , r = Me(t)
          , o = Vn(i.coordinates, r.coordinates);
        return 0 === o.length ? null : 1 === o.length ? X(o[0], n.properties) : Z(o, n.properties)
    }
    var Kn = {
        getLineCenter: function(e, t) {
            e instanceof BMapGL.Point && t instanceof BMapGL.Point && (e = J([e.lng, e.lat]),
            t = J([t.lng, t.lat]));
            var n = function(e, t) {
                return Re(e, Ae(e, t) / 2, Ne(e, t))
            }(e, t);
            return {
                geoCenter: n,
                bdCenter: new BMapGL.Point(n.geometry.coordinates[0],n.geometry.coordinates[1])
            }
        },
        getDistance: function(e, t) {
            var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "kilometers";
            return e instanceof BMapGL.Point && t instanceof BMapGL.Point && (e = J([e.lng, e.lat]),
            t = J([t.lng, t.lat])),
            Ae(e, t, {
                units: n
            })
        },
        getLength: function(e) {
            var t;
            return void 0 === (t = {
                units: arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "kilometers"
            }) && (t = {}),
            fe(e, (function(e, n) {
                var i = n.geometry.coordinates;
                return e + Ae(i[0], i[1], t)
            }
            ), 0)
        },
        getPolygonCenter: function(e) {
            var t = function(e, t) {
                void 0 === t && (t = {});
                var n = 0
                  , i = 0
                  , r = 0;
                return ae(e, (function(e) {
                    n += e[0],
                    i += e[1],
                    r++
                }
                ), !0),
                J([n / r, i / r], t.properties)
            }(e);
            return {
                geoCenter: t,
                bdCenter: new BMapGL.Point(t.geometry.coordinates[0],t.geometry.coordinates[1])
            }
        },
        getPolygonArea: function(e) {
            return e instanceof BMapGL.Polygon && (e = e.toGeoJSON()),
            mt(e) / 1e6
        },
        unionPolygon: function(e) {
            for (var t = e[0], n = 0, i = e.length; i > n; n++)
                t = Hn(t, e[n]);
            return t
        },
        isDisjoint: function(e, t) {
            return !Wt(e, t)
        },
        intersect: function(e, t) {
            var n = [];
            if (t.__proto__ instanceof BMapGL.Overlay) {
                if (!t.toGeoJSON)
                    return n;
                t = t.toGeoJSON()
            }
            return e.forEach((function(e) {
                var i = e;
                if (e.__proto__ instanceof BMapGL.Overlay) {
                    if (!e.toGeoJSON)
                        return !0;
                    i = e.toGeoJSON()
                }
                Kn.isDisjoint(i, t) && n.push(e)
            }
            )),
            n
        },
        isContains: function(e, t) {
            return Yt(e, t)
        },
        isPointOnLine: function(e, t) {
            var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {
                ignoreEndVertices: !1
            };
            return e instanceof BMapGL.Point && (e = e.toGeoJSON()),
            t instanceof BMapGL.Polyline && (t = t.toGeoJSON()),
            Et(e, t, n)
        },
        isPointInPolygon: function(e, t) {
            var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {
                ignoreBoundary: !0
            };
            return e instanceof BMapGL.Point && (e = e.toGeoJSON()),
            t instanceof BMapGL.Polygon && (t = t.toGeoJSON()),
            Oe(e, t, n)
        },
        getDistance2Lines: function(e, t) {
            return vt(J([e.lng, e.lat]), V(t))
        },
        getNearestPointOnLine: function(e, t) {
            var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "kilometers"
              , i = J([e.lng, e.lat])
              , r = [];
            if ("Polygon" === t.geometry.type ? r = t.geometry.coordinates[0] : "LineString" === t.geometry.type && (r = t.geometry.coordinates),
            2 > r.length)
                return {
                    toLineDistance: 1 / 0
                };
            var o = ut(V(r), i, n)
              , s = new BMapGL.Point(o.geometry.coordinates[0],o.geometry.coordinates[1]);
            return {
                geoPoint: i,
                geoNearestPoint: o,
                toLineDistance: Ae(i, o),
                bdNearestPoint: s
            }
        }
    }
      , Zn = function(e) {
        function t(e) {
            var r;
            return i(this, t),
            (r = n(this, t, [e] /* Map */)).point = void 0,
            r.overlay = void 0,
            r.map = e,
            r
        }
        return h(t, e),
        o(t, [{
            key: "confirmOperate",
            value: function() {
                var e = "" + (this.overlayStr||this.overlay);
                "Polyline" === e || "Polygon" === e ? this.overlay.disableEditing() : "Marker" === e && this.overlay.disableDragging(),
                this.dispatchEvent(new T("ok",this.overlay))
            }
        }, {
            key: "cancelOperate",
            value: function() {
                this.dispatchEvent(new T("cancel",this.overlay))
            }
        }, {
            key: "setPosition",
            value: function(e, t) {
                this.mapSetPosition(e);

                // this.point = e;
                // var n = this.map.pointToOverlayPixel(this.point);
                // t ? (this.div.classList.remove("operateLeft"),
                // this.div.style.left = n.x + 15 + "px") : (this.div.classList.add("operateLeft"),
                // this.div.style.left = n.x - 105 + "px"),
                // this.div.style.top = n.y - 16 + "px"
            }
        }, {
            key: "draw",
            value: function() {
                var e = this.map.pointToOverlayPixel(this.point);
                this.div.style.left = e.x + 15 + "px",
                this.div.style.top = e.y - 16 + "px"
            }
        }, {
            key: "calculateOverlay",
            value: function() {
                var e = {
                    data: 0
                };
                switch ("" + this.overlay) {
                case "Polyline":
                    e.data = 1e3 * Kn.getLength(this.overlay.toGeoJSON());
                    break;
                case "Polygon":
                    e.data = 1e6 * Kn.getPolygonArea(this.overlay);
                    break;
                case "Circle":
                    var t = this.overlay.getRadius();
                    e.data = Math.PI * t * t
                }
                return e.data = !e.data || 0 > e.data ? 0 : e.data.toFixed(2),
                e
            }
        }])
    }(_(BMapGL.Overlay, F))
      , qn = function(e) {
        function t(e, r) {
            var o, s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
            return i(this, t),
            (o = n(this, t, [e])).noLimit = !1,
            o.overlayTypeText = void 0,
            o.limit = void 0,
            o.element = r,
            s.noLimit && (o.noLimit = !!s.noLimit),
            o
        }
        return h(t, e),
        o(t, [{
            key: "setData",
            value: function(e) {
                for (var t in e)
                    e.hasOwnProperty(t) && (this[t] = e[t]);
                this.type = "" + this.overlay,
                "Marker" === this.type ? (this.overlayTypeText = "可以拖动图标改变位置",
                this.unit = "Polyline" === this.type ? "万米" : "万平方米") : this.overlayTypeText = "Polyline" === this.type ? "长度不超过" + (this.limit || 1e10) / 1e4 + "万米！" : "面积不超过" + (this.limit || 1e10) / 1e4 + "万平方米！"
            }
        }, {
            key: "initialize",
            value: function(e) {
                var t;
                this.element ? (t = this.div = this.element).className = "operateWindow" : ((t = this.div = document.createElement("div")).className = "operateWindow",
                t.innerHTML = '<div class="containerbox">\n                <span id="confirmOperate"></span>\n                <span id="cancelOperate"></span>\n                <span id="warnOperate">'.concat(this.overlayTypeText, "</span>\n                </div>"));
                return false&&e.getPanes().markerPane.appendChild(this.div),
                this.bind(),
                this.updateWindow(),
                t
            }
        }, {
            key: "bind",
            value: function() {
                var e = this;
                if (this.element)
                    throw {
                        errMsg: "自定义operate必须重写bind方法"
                    };

                
                // console.log('------ 111', e.div.querySelector('#confirmOperate'))
                // document.getElementById("confirmOperate")?.addEventListener("click", (function(t) {
                e.div.querySelector('#confirmOperate')?.addEventListener("click", (function(t) {
                    var n = e.calculateOverlay();
                    e.overlay.geometryCalculate = n,
                    e.confirmOperate()
                }
                )),
                // document.getElementById("cancelOperate")?.addEventListener("click", (function(t) {
                e.div.querySelector('#cancelOperate')?.addEventListener("click", (function(t) {
                    e.cancelOperate()
                }
                ))
            }
        }, {
            key: "updateWindow",
            value: function() {
                if (this.element)
                    throw {
                        errMsg: "自定义operate必须重写updateWindow方法"
                    };
                var e = this.limit || 1e7
                  , t = this.calculateOverlay();
                // document.getElementById("confirmOperate") && (t.data > ~~e && !this.noLimit ? (document.getElementById("confirmOperate").style.display = "none",
                // document.getElementById("warnOperate").style.display = "block") : (document.getElementById("confirmOperate").style.display = "block",
                // document.getElementById("warnOperate").style.display = "none"))
                const elConfirm = this.div.querySelector('#confirmOperate');
                const elCancel = this.div.querySelector('#cancelOperate');
                const elWarn = this.div.querySelector('#warnOperate');
                elConfirm && (t.data > ~~e && !this.noLimit ? (elConfirm.style.display = "none",
                elWarn.style.display = "block") : (elConfirm.style.display = "block",
                elWarn.style.display = "none"))
            }
        }])
    }(Zn)
      , $n = function(e) {
        function t(e, r) {
            var o;
            return i(this, t),
            (o = n(this, t, [e] /* Map */))._enableEdgeMove = !1,
            o.cursor = "crosshair",
            (!('container' in o) && (o.container = void 0)),
            o.map = e,
            r && (o.cursor = r),
            o
        }
        return h(t, e),
        o(t, [{
            key: "initialize",
            value: function(e) {
                var t = this;
                this.dispose();
                var n = e.getSize()
                  , i = this.container = document.createElement("div");
                this.container.classList.add('scene-mask');
                return i.style.cssText = "position:absolute;background:transparent;\n            cursor:".concat(this.cursor, ";width:").concat(n.width, "px;height:").concat(n.height, "px"),
                e.addEventListener("resize", (function(e) {
                    t.adjustSize(e.size)
                }
                )),
                (e.getPanes().floatPane||e.floatPane).appendChild(i),
                this.bindEvent(),
                i
            }
        }, {
            key: "draw",
            value: function() {
                var e = this.map.pixelToPoint(new BMapGL.Pixel(0,0))
                  , t = this.map.pointToOverlayPixel(e);
                this.container.style.left = t.x + "px",
                this.container.style.top = t.y + "px"
            }
        }, {
            key: "setCursor",
            value: function(e) {
                this.cursor = e,
                this.container && (this.container.style.cursor = e)
            }
        }, {
            key: "adjustSize",
            value: function(e) {
                this.container.style.width = e.width + "px",
                this.container.style.height = e.height + "px"
            }
        }, {
            key: "bindEvent",
            value: function() {
                for (var e = this, t = null, n = null, i = function(e) {
                    return {
                        x: e.clientX,
                        y: e.clientY
                    }
                }, r = function(r) {
                    var o = r.type
                      , s = e.getDrawLatlngPoint(r)
                      , a = function(t) {
                        r.point = s,
                        e.dispatchEvent(r)
                    };
                    "mousedown" === o && (t = i(r));
                    var l = i(r);
                    "click" === o ? 5 > Math.abs(l.x - t.x) && 5 > Math.abs(l.y - t.y) && (n && 5 > Math.abs(l.x - n.x) && 5 > Math.abs(l.y - n.y) ? n = null : (a(),
                    n = i(r))) : a()
                }, o = ["click", "mousedown", "mousemove", "mouseup", "dblclick", "rightclick"], s = o.length; s--; )
                    D.on(this.container, o[s], r, this._listeners);
                D.on(this.container, "mousemove", (function(t) {
                    e._enableEdgeMove && e.mousemoveAction(t)
                }
                ), this._listeners)
            }
        }, {
            key: "mousemoveAction",
            value: function(e) {
                var t = this;
                var n = this.map.pointToPixel(this.getDrawLatlngPoint(e))
                  , i = function(e) {
                    var t = e.clientX
                      , n = e.clientY;
                    return e.changedTouches && (t = e.changedTouches[0].clientX,
                    n = e.changedTouches[0].clientY),
                    new BMapGL.Pixel(t,n)
                }(e);
                n = new BMapGL.Pixel(i.x - (i.x - n.x),i.y - (i.y - n.y)),
                this.draggingMovePixel = n,
                this.panByX = this.panByY = 0;
                n.x >= 4 && 20 >= n.x || n.x >= this.map.width - 20 && this.map.width - 4 >= n.x || n.y >= 4 && 50 >= n.y || n.y >= this.map.height - 10 && this.map.height - 4 >= n.y ? (n.x > 20 ? this.map.width - 20 > n.x || (this.panByX = -8) : this.panByX = 8,
                n.y > 50 ? this.map.height - 10 > n.y || (this.panByY = -8) : this.panByY = 8,
                this.edgeMoveTimer || (this.edgeMoveTimer = setInterval((function() {
                    t.map.panBy(t.panByX, t.panByY, {
                        noAnimation: !0
                    })
                }
                ), 30))) : this.edgeMoveTimer && (clearInterval(this.edgeMoveTimer),
                this.edgeMoveTimer = null)
            }
        }, {
            key: "getDrawLatlngPoint",
            value: function(e) {
                var t = D.getTarget(e)
                  , n = e.offsetX || e.layerX || 0
                  , i = e.offsetY || e.layerY || 0;
                for (1 !== t.nodeType && (t = t.parentNode); t && t !== this.map.getContainer(); )
                    0 === t.clientWidth && 0 === t.clientHeight && t.offsetParent && "TD" === t.offsetParent.nodeName || (n += t.offsetLeft || 0,
                    i += t.offsetTop || 0),
                    t = t.offsetParent;
                var r = new BMapGL.Pixel(n,i);
                return this.map.pixelToPoint(r)
            }
        }, {
            key: "enableEdgeMove",
            value: function() {
                this._enableEdgeMove = !0
            }
        }, {
            key: "disableEdgeMove",
            value: function() {
                clearInterval(this.edgeMoveTimer),
                this._enableEdgeMove = !1
            }
        }])
    }(_(BMapGL.Overlay, F))
      , ei = function(e) {
        console.log('----- DrawScene');
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            if (i(this, t),
            (r = n(this, t)).isOpen = void 0,
            r.drawType = void 0,
            r.instances = [],
            r.selectInstance = [],
            r.mask = void 0,
            r.map = void 0,
            r.operate = void 0,
            r._currentStatus = y.STATUS_FREE,
            r._runningAction = null,
            r._stopClick = !1,
            r.noLimit = !1,
            !(e instanceof BMapGL.Map))
                throw Error("Scene实例化必须输入map参数");
            return e._printLog && e._printLog("bmapdraw"),
            r.options = {},
            D.deepCopy(B, 2, r.options, 0, [qn]),
            D.copyOptions(r.options, o, [qn]),
            o.noLimit ? (r.noLimit = !!o.noLimit,
            r.operate = r.options.operate || new qn(e,null,{
                noLimit: !0
            })) : r.operate = r.options.operate || new qn(e),
            r.options.operate && (r.options.operate.ignore = !0),
            r.map = e,
            r.mask = new $n(e,r.options.drawCursor),
            r.addMapListener(e),
            document.onkeydown = function(e) {
                e.keyCode === r.options.keyCode && (r._stopClick = !0)
            }
            ,
            document.onkeyup = function(e) {
                e.keyCode === r.options.keyCode && (r._stopClick = !1)
            }
            ,
            r
        }
        return h(t, e),
        o(t, [{
            key: "currentStatus",
            get: function() {
                return this._currentStatus
            },
            set: function(e) {
                this._currentStatus = e,
                this.updateMapListenerControl(e)
            }
        }, {
            key: "runningAction",
            get: function() {
                return this._runningAction
            },
            set: function(e) {
                this._runningAction = e
            }
        }, {
            key: "addMapListener",
            value: function(e) {
                var t = this;
                this.mapSelect = new W(e),
                this.mapSelect.addEventListener(b.CLICK, (function(e) {
                    t._currentStatus !== y.STATUS_MOVE && t.dispatchEvent(e)
                }
                )),
                this.mapSelect.addEventListener(b.RIGHTCLICK, (function(e) {
                    t._currentStatus !== y.STATUS_MOVE && t.dispatchEvent(e)
                }
                )),
                this.mapSelect.addEventListener(b.MOVE, (function(e) {
                    // t._currentStatus !== y.STATUS_DRAWING && t._currentStatus !== y.STATUS_EDITER && t._currentStatus !== y.STATUS_MOVE && t.dispatchEvent(e)
                }
                ));

                // BM.Draw.Event.EDITVERTEX
                // console.log('------ BM.Draw.Event', BM.Draw.Event)
                t.mapSelect.map.addEventListener('draw:editvertex', function(e) {
                    // console.log('------ draw:editvertex', e)
                    t.dispatchEvent({
                        currentTarget: null,
                        returnValue: true,
                        target: e,
                        type: b.MOVE,
                    });
                });
                // t.mapSelect.map.addEventListener('draw:editmove', function(e) {
                //     console.log('---- move', e)
                // });
                // t.mapSelect.map.addEventListener('draw:editresize', function(e) {
                //     console.log('---- resize', e)
                // });
            }
        }, {
            key: "updateMapListenerControl",
            value: function(e) {
                if (this.mapSelect)
                    switch (e) {
                    case y.STATUS_FREE:
                        this.mapSelect.open();
                        break;
                    case y.STATUS_EDITER:
                        this.mapSelect.openClick(),
                        this.mapSelect.openMouse();
                        break;
                    case y.STATUS_DRAWING:
                    case y.STATUS_MOVE:
                        this.mapSelect.closeClick(),
                        this.mapSelect.openMouse();
                        break;
                    default:
                        this.mapSelect.open()
                    }
            }
        }, {
            key: "open",
            value: function() {
                return this.isOpen = !0,
                this.mask || (this.mask = new $n(this.map,this.options.drawCursor)),
                this.map.addOverlay(this.mask),
                this.setCurrentDrawType(this.drawType),
                !0
            }
        }, {
            key: "close",
            value: function() {
                var e = 0 >= arguments.length || void 0 === arguments[0] || arguments[0];
                this.isOpen = !1,
                this.closeRunningAction(),
                e && (this.currentStatus = y.STATUS_FREE),
                this.mask && this.map.removeOverlay(this.mask)
            }
        }, {
            key: "closeRunningAction",
            value: function() {
                this.runningAction && this.runningAction.close instanceof Function && this.runningAction.close()
            }
        }, {
            key: "addOverlay",
            value: function(e) {
                this.instances.find((function(t) {
                    return t === e
                }
                )) || this.instances.push(e)
            }
        }, {
            key: "removeOverlay",
            value: function(e) {
                var t = this.instances.findIndex((function(t) {
                    return t === e
                }
                ));
                -1 !== t && (this.map.removeOverlay(this.instances[t]),
                this.instances.splice(t)),
                this.operate && this.map.removeOverlay(this.operate)
            }
        }, {
            key: "clearData",
            value: function() {
                var e = this;
                this.instances.forEach((function(t) {
                    e.map.removeOverlay(t)
                }
                )),
                this.instances.length = 0
            }
        }, {
            key: "addSelectDrawData",
            value: function(e) {
                this.selectInstance.find((function(t) {
                    return t === e
                }
                )) || this.selectInstance.push(e)
            }
        }, {
            key: "hasOverlay",
            value: function(e) {
                var t = this.instances.findIndex((function(t) {
                    return t === e
                }
                ));
                return t > -1 || (t = this.selectInstance.findIndex((function(t) {
                    return t === e
                }
                ))) > -1
            }
        }, {
            key: "clearSelectDrawData",
            value: function() {
                var e = this;
                this.selectInstance.forEach((function(t) {
                    e.map.removeOverlay(t)
                }
                )),
                this.selectInstance.length = 0
            }
        }, {
            key: "setCurrentDrawType",
            value: function(e) {
                this.drawType = e
            }
        }, {
            key: "attachSnapSource",
            value: function(e) {
                this._attachSnapSource = e
            }
        }, {
            key: "setDrawCursor",
            value: function(e) {
                this.mask && this.mask.setCursor(e)
            }
        }, {
            key: "getStopStatus",
            value: function() {
                return this._stopClick
            }
        }])
    }(F)
      , ti = function(e, t) {
        var n, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 10, r = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : [], o = (n = (arguments.length > 3 ? arguments[3] : void 0).getZoom(),
        Math.pow(2, 18 - n));
        i *= o;
        var a, l = s(t);
        try {
            var h, c = function() {
                var t = a.value;
                if (r.find((function(e) {
                    return t === e
                }
                )))
                    return 0;
                if (t instanceof BMapGL.Marker) {
                    var n = t.getPosition()
                      , o = 1e3 * Kn.getDistance(e, n, "kilometers");
                    return i > o ? {
                        v: n
                    } : 0
                }
                if (t.toGeoJSON) {
                    var l = t.getPath()
                      , h = []
                      , c = t.toGeoJSON();
                    if (t.hasMultipleParts) {
                        for (var u = [], p = 0; l.length > p; p++) {
                            for (var v = 0; l[p].length - 1 > v; v++)
                                h.push(Kn.getLineCenter(l[p][v], l[p][v + 1]).bdCenter),
                                u.push(l[p][v]);
                            u.push(l[p][l[p].length - 1])
                        }
                        l = u
                    } else
                        for (var d = 0; l.length - 1 > d; d++)
                            h.push(Kn.getLineCenter(l[d], l[d + 1]).bdCenter);
                    var f, g = s(l.concat(h));
                    try {
                        for (g.s(); !(f = g.n()).done; ) {
                            var m = f.value
                              , y = 1e3 * Kn.getDistance(e, m, "kilometers");
                            if (i > y)
                                return {
                                    v: m
                                }
                        }
                    } catch (e) {
                        g.e(e)
                    } finally {
                        g.f()
                    }
                    if ("MultiPolygon" === c.geometry.type)
                        return 0;
                    var b = Kn.getNearestPointOnLine(e, c);
                    if (i > 1e3 * b.toLineDistance)
                        return {
                            v: b.bdNearestPoint
                        }
                }
            };
            for (l.s(); !(a = l.n()).done; )
                if (0 !== (h = c()) && h)
                    return h.v
        } catch (e) {
            l.e(e)
        } finally {
            l.f()
        }
        return null
    };
    var ni = function(e) {
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            if (i(this, t),
            (r = n(this, t)).type = void 0,
            r.isOpen = void 0,
            r.isOnMap = !0,
            r.isSeries = !0,
            r.skipEditing = !1,
            r.isSelectDraw = !1,
            r.enableCalculate = !1,
            r.enableSnap = !0,
            r.snapDistance = 10,
            r.enableDragging = !1,
            r.mouseLnglat = void 0,
            r.match = null,
            r.matchOverlay = null,
            r.matchOverlayRadius = 5,
            r.limitPoint = -1,
            r.deletable = !1,
            !e)
                return u(r);
            if (!(e instanceof ei))
                throw Error("DrawBase实例化必须输入scene参数");
            r.scene = e;
            var s = {};
            return D.copyOptionsToNew(r.scene.options, o, s),
            D.copyNotExitOptions(s, r.scene.options),
            r.defineProperty(s),
            r.options = s,
            r.setSnapPointType(r.options),
            r.setBaseOptions(r.options.baseOpts),
            r
        }
        return h(t, e),
        o(t, [{
            key: "bindEvent",
            value: function() {}
        }, {
            key: "setBaseOptions",
            value: function() {
                this.baseOptions = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
            }
        }, {
            key: "setCurrentStatus",
            value: function(e) {
                this.scene.currentStatus = e
            }
        }, {
            key: "skipEdit",
            value: function(e) {
                e || this.skipEditing ? this.scene.operate.confirmOperate() : this.scene.mask.hide()
            }
        }, {
            key: "emitEventIsonmap",
            value: function(e) {
                var t = E.DRAW_ON_MAP;
                this.isSelectDraw && (t = E.SELECT_ON_MAP);
                var n = new T(b.COMPLETE,{
                    overlay: e,
                    from: t
                });
                this.dispatchEvent(n),
                this.scene.dispatchEvent(n)
            }
        }, {
            key: "emitEventIsnomap",
            value: function(e) {
                this.scene.currentStatus = y.STATUS_FREE;
                var t = E.DRAW_NO_MAP;
                this.isSelectDraw && (t = E.SELECT_NO_MAP);
                var n = new T(b.COMPLETE,{
                    overlay: e,
                    from: t
                });
                this.dispatchEvent(n),
                this.scene.dispatchEvent(n)
            }
        }, {
            key: "registEvent",
            value: function(e) {
                var t = this;
                e.addEventListener(b.INIT, (function(e) {
                    t.skipEdit()
                }
                )),
                e.addEventListener(b.COMPLETE, (function(e) {
                    t.isSelectDraw ? t.scene.addSelectDrawData(e.target.overlay) : t.isCotiHole ? (t.scene.map.removeOverlay(e.target.overlay),
                    t.holeCut && t.holeCut(e.target.overlay)) : t.scene.addOverlay(e.target.overlay),
                    !1 !== e.continue && t.isSeries && (t.isOpen = !0,
                    t.scene.mask.show(),
                    t.bindEvent()),
                    t.isCotiHole && (e.target.overlay = t.holeSource),
                    t.dispatchEvent(e),
                    t.editOpe = null
                }
                )),
                e.addEventListener(b.CANCEL, (function(e) {
                    t.isSeries && (t.isOpen = !0,
                    t.scene.mask.show(),
                    t.bindEvent()),
                    t.isCotiHole && (e.target.overlay = t.holeSource),
                    t.dispatchEvent(e),
                    t.editOpe = null
                }
                ))
            }
        }, {
            key: "setRunningAction",
            value: function(e, t) {
                if (e) {
                    if (this.isSeries && this.scene.runningAction === this)
                        return void t();
                    this.scene.closeRunningAction(),
                    this.scene.mask.show(),
                    this.scene.runningAction = this,
                    t(),
                    this.callback && this.callback()
                } else
                    this.scene.runningAction = null,
                    this.isOpen = !1,
                    this.scene.mask.hide()
            }
        }, {
            key: "closeEdit",
            value: function() {
                this.editOpe && this.editOpe.close()
            }
        }, {
            key: "closeAll",
            value: function() {
                this.scene.currentStatus === y.STATUS_DRAWING && this.removeDrawing(),
                this.close(),
                this.closeEdit(),
                this.scene.mask.disableEdgeMove()
            }
        }, {
            key: "open",
            value: function(e) {
                this.scene && (this.callback = e,
                this.scene.drawType = this.type,
                this.scene.open(),
                this.isOpen = !0,
                this.bindEvent())
            }
        }, {
            key: "close",
            value: function(e) {
                e && e()
            }
        }, {
            key: "removeDrawing",
            value: function() {}
        }, {
            key: "addLabel",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}
                  , n = new BMapGL.Label(e,{
                    position: t.position,
                    offset: t.offset || new BMapGL.Size(0,0)
                });
                return n.setStyle(t.labelOptions),
                n
            }
        }, {
            key: "setRadius",
            value: function() {
                var e = this.scene.map.getZoomUnits();
                this.matchOverlay.setRadius(this.matchOverlayRadius * e)
            }
        }, {
            key: "addMatchOverlay",
            value: function(e) {
                this.matchOverlay instanceof BMapGL.Circle ? (this.setRadius(),
                this.matchOverlay.setCenter(e),
                this.scene.map.addEventListener("zoomend", this._setRadius = this.setRadius.bind(this)),
                this.scene.map.addOverlay(this.matchOverlay)) : (this.scene.map.addOverlay(this.matchOverlay),
                this.matchOverlay.setPosition(e))
            }
        }, {
            key: "removeMatchOverlay",
            value: function() {
                this.scene.map.removeOverlay(this.matchOverlay),
                this._setRadius && (this.scene.map.removeEventListener("zoomend", this._setRadius),
                this._setRadius = null)
            }
        }, {
            key: "getSnap",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.scene.instances
                  , n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : []
                  , i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : this.snapDistance
                  , r = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : this.scene.map
                  , o = null;
                return this.removeMatchOverlay(),
                !o && t.length && (o = ti(e, t, i, r)),
                !o && void 0 !== this.scene._attachSnapSource && "null" != typeof this.scene._attachSnapSource && this.scene._attachSnapSource.length && (o = ti(e, this.scene._attachSnapSource, i, r)),
                o || (o = ti(e, n, i, r)),
                o && this.addMatchOverlay(o),
                o
            }
        }])
    }(F)
      , ii = function(e) {
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            return i(this, t),
            (r = n(this, t, [e, o])).type = k.DRAWING_MARKER,
            r.scene.setCurrentDrawType(r.type),
            r.mouseMoveModel = o.mouseMove || !1,
            r.isOpen && r.open(),
            r
        }
        return h(t, e),
        o(t, [{
            key: "clickAction",
            value: function(e) {
                var t = this;
                this.scene.getStopStatus() || this.marker && !this.isOnMap || (this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.removeEventListener("click", this.click),
                this.marker = new BMapGL.Marker(e.point,this.baseOptions),
                this.scene.map.addOverlay(this.marker),
                this.isSeries ? this.isOnMap || this.bindEvent() : this.scene.mask.hide(),
                this.isOnMap ? (this.isSeries ? (this.scene.mask.show(),
                this.bindEvent()) : this.setCurrentStatus(y.STATUS_FREE),
                this.scene.addOverlay(this.marker),
                this.emitEventIsonmap(this.marker),
                this.enableDragging && (this.marker.enableDragging(),
                this.marker.addEventListener("dragstart", this.centerDragstart.bind(this)),
                this.marker.addEventListener("dragging", this.centerDragging.bind(this)),
                this.marker.addEventListener("dragend", this.centerDragend.bind(this)))) : (setTimeout((function() {
                    t.scene.map.removeOverlay(t.marker),
                    t.marker = null
                }
                ), 200),
                this.emitEventIsnomap(this.marker)))
            }
        }, {
            key: "moveAction",
            value: function(e) {
                var t = new T(b.MOVE,e);
                this.dispatchEvent(t)
            }
        }, {
            key: "centerDragstart",
            value: function(e) {
                if (this.enableSnap) {
                    var t, n = e.target, i = BMapGL.Projection.convertMC2LL(n.point);
                    (t = this.getSnap(i, this.scene.instances)) && (e.point = BMapGL.Projection.convertLL2MC(t),
                    n.setPoint(e.point))
                }
            }
        }, {
            key: "centerDragging",
            value: function(e) {
                if (this.enableSnap) {
                    var t, n = e.target, i = BMapGL.Projection.convertMC2LL(n.point);
                    (t = this.getSnap(i, this.scene.instances)) && (e.point = BMapGL.Projection.convertLL2MC(t),
                    n.setPoint(e.point))
                }
            }
        }, {
            key: "centerDragend",
            value: function(e) {
                this.emitEventIsonmap(this.marker)
            }
        }, {
            key: "bindEvent",
            value: function() {
                var e = this;
                this.isOpen && d(t, "setRunningAction", this, 3)([!0, function() {
                    e.setCurrentStatus(y.STATUS_DRAWING),
                    e.mouseMoveModel && e.scene.mask.addEventListener("mousemove", e.mousemove = e.moveAction.bind(e)),
                    e.scene.mask.addEventListener("click", e.click = e.clickAction.bind(e))
                }
                ])
            }
        }, {
            key: "close",
            value: function(e) {
                d(t, "setRunningAction", this, 3)([!1]),
                this.scene.mask.removeEventListener("click", this.click),
                this.mouseMoveModel && this.scene.mask.addEventListener("mousemove", this.mousemove),
                e && e()
            }
        }])
    }(ni)
      , ri = function(e) {
        function t(e, r) {
            var o, s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
            if (i(this, t),
            (o = n(this, t)).overlay = null,
            o.centerIcon = null,
            o.moveIcon = null,
            o.circleMoveIcon = null,
            !(e instanceof ei))
                throw Error("EditBase实例化必须输入scene参数");
            o.scene = e;
            var a = {};
            return D.copyOptionsToNew(o.scene.options, s, a),
            D.copyNotExitOptions(a, o.scene.options),
            o.target = r || o,
            o.setOptions(a),
            o
        }
        return h(t, e),
        o(t, [{
            key: "setOptions",
            value: function() {
                var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
                this.defineProperty(e),
                this.baseOptions = this.target.__proto__ instanceof ni ? this.target.baseOptions : e.baseOpts
            }
        }, {
            key: "saveSouce",
            value: function(e) {
                this.source = this.type === k.DRAWING_CIRCLE ? {
                    center: e.getCenterIn().latLng,
                    radius: e.getRadius()
                } : e.toGeoJSON()
            }
        }, {
            key: "restoreSouce",
            value: function(e) {
                this.source && (this.type === k.DRAWING_CIRCLE ? (e.setCenter(this.source.center),
                e.setRadius(this.source.radius)) : e.updateByGeoJSON(this.source),
                this.restoreOpe(e))
            }
        }, {
            key: "restoreOpe",
            value: function() {}
        }, {
            key: "open",
            value: function(e, t, n) {
                var i = this;
                if (this.scene)
                    return this.originStyle = {
                        icon: e._config.icon,
                        fillColor: e._config.fillColor,
                        fillOpacity: e._config.fillOpacity,
                        strokeColor: e._config.strokeColor,
                        strokeWeight: e._config.strokeWeight,
                        strokeOpacity: e._config.strokeOpacity
                    },
                    this.overlay = e,
                    this.overlay.setOptions(this.baseOptions),
                    this.type === k.DRAWING_POLYLINE && 2 > this.overlay.points.length || this.type === k.DRAWING_POLYGON && 3 > this.overlay.points.length ? (this.close(),
                    void this.scene.mask.hide()) : void this.setRunningAction(!0, (function() {
                        i.setSceneStatus(y.STATUS_EDITER),
                        i.edit(e, t),
                        n && n()
                    }
                    ))
            }
        }, {
            key: "emitOkEvent",
            value: function(e) {
                var t = 1 >= arguments.length || void 0 === arguments[1] || arguments[1]
                  , n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]
                  , i = E.DRAW_ON_MAP;
                this.target.__proto__ instanceof ni ? (this.target.isSelectDraw && (i = E.SELECT_ON_MAP),
                this.target.isCotiHole && (i = E.DRAW_ON_MAP)) : i = E.EDIT_ON_MAP;
                var r = new T(b.COMPLETE,{
                    overlay: e,
                    from: i
                });
                r.continue = t,
                this.dispatchEvent(r),
                (n || this.type !== k.DRAWING_MARKER) && this.scene.dispatchEvent(r)
            }
        }, {
            key: "close",
            value: function() {
                console.log('------ operateWindow close')

                const isCancel = this.overlay.getPath()<3 && (this.type==K.DRAWING_POLYGON || this.type==K.DRAWING_POLYLINE);
                if (!isCancel) {
                    this.scene.map.removeOverlay(this.overlay);
                }

                var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]
                  , t = arguments.length > 1 ? arguments[1] : void 0;
                this.overlay && (this.overlay.setOptions(this.originStyle),
                this.setRunningAction(!1),
                this.setSceneStatus(y.STATUS_FREE),
                this.operateWindow && (this.removeAttachOverlays(),
                this.scene.map.removeOverlay(this.operateWindow)),
                e || this.emitOkEvent(this.overlay, e),
                this.type !== k.DRAWING_POLYLINE && this.type !== k.DRAWING_POLYGON || this.overlay.removeEventListener("lineupdate", this.lineUpdate),
                this.closeOpe(this.overlay),
                t && t());
            }
        }, {
            key: "setRunningAction",
            value: function(e, t) {
                e ? (this.scene.closeRunningAction(),
                this.scene.runningAction = this,
                t()) : this.scene.runningAction = null
            }
        }, {
            key: "closeOpe",
            value: function(e) {}
        }, {
            key: "addOperateWindow",
            value: function(e) {
                var t = this
                  , n = E.DRAW_ON_MAP;
                this.target.__proto__ instanceof ni ? this.target.isSelectDraw && (n = E.SELECT_ON_MAP) : (this.saveSouce(e.overlay),
                n = E.EDIT_ON_MAP);
                var i = this.operateWindow = this.scene.operate || new qn(this.scene.map);
                i.setPosition(e.point);
                i.show();
                return i.setData(e),
                i.addEventListener("ok", (function(e) {
                    i.hide();
                    t.removeAttachOverlays(),
                    t.close(!0),
                    t.emitOkEvent(e.target),
                    i._listeners = {}
                }
                )),
                i.addEventListener("cancel", (function(r) {
                    i.hide();
                    t.removeAttachOverlays(),
                    t.close(!0),
                    t.target.__proto__ instanceof ni ? t.scene.map.removeOverlay(e.overlay) : t.restoreSouce(e.overlay);
                    var o = new T(b.CANCEL,{
                        overlay: r.target,
                        from: n += "-cancel"
                    });
                    t.dispatchEvent(o),
                    t.scene.dispatchEvent(o),
                    i._listeners = {}
                }
                )),
                this.scene.map.addOverlay(i, this.scene.map.drawingGroup),
                i
            }
        }, {
            key: "removeAttachOverlays",
            value: function() {
                for (var e = this.scene.map, t = this.overlays, n = 0; t.length > n; n++)
                    if (Array.isArray(t[n]))
                        for (var i in t[n])
                            e.removeOverlay(t[n][i]);
                    else
                        e.removeOverlay(t[n])
            }
        }, {
            key: "getSnap",
            value: function(e) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : []
                  , n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : this.scene.snapDistance
                  , i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : this.scene.map
                  , r = null;
                return r || (r = ti(e, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.scene.instances, n, i)),
                !r && void 0 !== this.scene._attachSnapSource && "null" != typeof this.scene._attachSnapSource && this.scene._attachSnapSource.length && (r = ti(e, this.scene._attachSnapSource, n, i)),
                r || (r = ti(e, t, n, i)),
                r
            }
        }])
    }(F)
      , oi = function(e) {
        function t(e, r, o) {
            var s;
            return i(this, t),
            (s = n(this, t, [e, r, o])).type = k.DRAWING_POLYLINE,
            s.scene.setCurrentDrawType(s.type),
            s
        }
        return h(t, e),
        o(t, [{
            key: "edit",
            value: function(e, t) {
                var n = this;
                this.overlay = e;
                var i = {
                    limit: t || null,
                    point: this.getNorthEast(e.hasMultipleParts ? e.getPath()[0] : e.getPath()),
                    overlay: e
                };
                this.overlays = [];
                var r = this.addOperateWindow(i);
                this.lineUpdate = function(t) {
                    var i = n.getNorthEast(e.hasMultipleParts ? e.getPath()[0] : e.getPath());
                    r.setPosition(i, !0),
                    r.updateWindow();
                    var o = new T(b.CHANGE,t.currentTarget);
                    n.target.dispatchEvent(o)
                }
                ,
                this.onlinevertexdragging = function(e) {
                    var t = e.overlay
                      , i = BMapGL.Projection.convertMC2LL(t.getPoint())
                      , r = i;
                    n.enableSnap && (r = n.getSnap(i, n.scene.instances, [n.overlay])),
                    r && (e.from.point = BMapGL.Projection.convertLL2MC(r),
                    t.setPoint(e.from.point))
                }
                ,
                e.enableEditing(),
                e.addEventListener("lineupdate", this.lineUpdate),
                e.addEventListener("onlinevertexdragging", this.onlinevertexdragging),
                this.dispatchEvent(new T(b.INIT))
            }
        }, {
            key: "restoreOpe",
            value: function(e) {
                e.disableEditing()
            }
        }, {
            key: "closeOpe",
            value: function(e) {
                e.disableEditing()
            }
        }, {
            key: "getNorthEast",
            value: function(e) {
                for (var t = 0, n = 0, i = 0; e.length > i; i++)
                    e[i].lng > t && (t = e[i].lng,
                    n = i);
                return e[n]
            }
        }])
    }(ri)
      , si = function(e) {
        function t(e, r, o) {
            var s;
            return i(this, t),
            (s = n(this, t, [e, r, o])).type = k.DRAWING_POLYGON,
            s.scene.setCurrentDrawType(s.type),
            s
        }
        return h(t, e),
        o(t)
    }(oi)
      , ai = function(e) {
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            return i(this, t),
            (r = n(this, t, [e, o])).type = k.DRAWING_POLYLINE,
            r.points = [],
            r.drawPoint = [],
            r.overlay = null,
            r.isBinded = !1,
            r.tipLabel = null,
            r.measureRes = 0,
            r.hideTip = !1,
            o.hideTip && (r.hideTip = o.hideTip),
            r.scene.setCurrentDrawType(r.type),
            r.isOpen && r.open(),
            r
        }
        return h(t, e),
        o(t, [{
            key: "getNorthEast",
            value: function(e) {
                for (var t = 0, n = 0, i = 0; e.length > i; i++)
                    e[i].lng > t && (t = e[i].lng,
                    n = i);
                return e[n]
            }
        }, {
            key: "startAction",
            value: function(e) {
                this.scene.getStopStatus() || (this.points.push(this.match ? this.match : e.point),
                this.drawPoint = this.points.concat(this.points[this.points.length - 1]),
                1 === this.points.length ? (this.scene.drawType === k.DRAWING_POLYLINE ? this.overlay = new BMapGL.Polyline(this.drawPoint,this.baseOptions) : this.scene.drawType === k.DRAWING_POLYGON && (this.overlay = new BMapGL.Polygon(this.drawPoint,this.baseOptions)),
                this.scene.map.addOverlay(this.overlay)) : (this.overlay.setPath(this.drawPoint),
                this.limitPoint > 0 && this.points.length >= this.limitPoint && this.scene.drawType === k.DRAWING_POLYLINE && this.dblclickAction(e)),
                this.isBinded || (this.isBinded = !0,
                this.deletable = !0,
                this.scene.mask.enableEdgeMove(),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.addEventListener("mousemove", this.mousemove = this.moveAction.bind(this)),
                this.scene.mask.addEventListener("dblclick", this.dblclick = this.dblclickAction.bind(this))))
            }
        }, {
            key: "moveAction",
            value: function(e) {
                if (this.scene.getStopStatus())
                    this.scene.map.removeOverlay(this.tipLabel);
                else {
                    var t = e.point;
                    if (this.enableSnap) {
                        var n = [];
                        if (this.overlay.points.length > 2) {
                            var i = this.overlay.getPath().slice(0, this.overlay.points.length - 1);
                            n.push(new this.overlay.constructor(i))
                        }
                        if (this.match = this.getSnap(t, this.scene.instances, n),
                        this.match)
                            return void this.overlay.setPositionAt(this.drawPoint.length - 1, this.match)
                    }
                    this.match = null,
                    this.overlay.setPositionAt(this.drawPoint.length - 1, e.point),
                    this.hideTip || (this.scene.map.removeOverlay(this.tipLabel),
                    this.tipLabel = new BMapGL.Label("单击绘制下一个点，双击完成绘制",{
                        position: e.point,
                        offset: new BMapGL.Size(10,10)
                    }),
                    this.tipLabel.setStyle(this.options.labelOptions),
                    this.scene.map.addOverlay(this.tipLabel))
                }
            }
        }, {
            key: "mousemoveAction",
            value: function(e) {
                var t = this;
                this.scene.getStopStatus() ? this.scene.map.removeOverlay(this.tipLabel) : (4 !== e.buttons && (D.preventDefault(e),
                D.stopBubble(e)),
                this.enableSnap && (this.match = this.getSnap(e.point, this.scene.instances)),
                this.hideTip || setTimeout((function() {
                    t.scene.map.removeOverlay(t.tipLabel),
                    t.tipLabel = new BMapGL.Label("单击确认起点",{
                        position: e.point,
                        offset: new BMapGL.Size(10,10)
                    }),
                    t.tipLabel.setStyle(t.options.labelOptions),
                    t.scene.map.addOverlay(t.tipLabel)
                }
                ), 60))
            }
        }, {
            key: "dblclickAction",
            value: function(e) {
                if (D.preventDefault(e),
                D.stopBubble(e),
                this.isBinded = !1,
                this.deletable = !1,
                this.scene.map.removeOverlay(this.matchOverlay),
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.mask.disableEdgeMove(),
                this.scene.mask.removeEventListener("click", this.click),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.removeEventListener("dblclick", this.dblclick),
                this.overlay.setPath(this.points),
                this.isSeries ? this.isOnMap || this.bindEvent() : this.scene.mask.hide(),
                this.isOnMap) {
                    var t = null;
                    this.limit && (t = "polygon" === this.scene.drawingType ? this.limit.area : this.limit.distance),
                    this.editOpe = this.type === k.DRAWING_POLYLINE ? new oi(this.scene,this) : new si(this.scene,this);
                    var n = this.editOpe;
                    this.registEvent(n),
                    n.open(this.overlay, t)
                } else
                    this.scene.map.removeOverlay(this.overlay),
                    this.type === k.DRAWING_POLYGON && this.isCotiHole && this.holeCut && this.holeCut(this.overlay),
                    this.emitEventIsnomap(this.overlay)
            }
        }, {
            key: "bindEvent",
            value: function() {
                var e = this;
                this.isOpen && d(t, "setRunningAction", this, 3)([!0, function() {
                    e.points.length = 0,
                    e.drawPoint.length = 0,
                    e.setCurrentStatus(y.STATUS_DRAWING),
                    e.deletable = !1,
                    e.click && e.mousemove && (e.isBinded = !1,
                    e.scene.mask.removeEventListener("click", e.click),
                    e.scene.mask.removeEventListener("mousemove", e.mousemove)),
                    e.scene.mask.addEventListener("mousemove", e.mousemove = e.mousemoveAction.bind(e)),
                    e.scene.mask.addEventListener("click", e.click = e.startAction.bind(e))
                }
                ])
            }
        }, {
            key: "removeDrawing",
            value: function() {
                this.deletable && this.scene.map.removeOverlay(this.overlay)
            }
        }, {
            key: "close",
            value: function(e) {
                this.isBinded = !1,
                this.deletable = !1,
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.map.removeOverlay(this.matchOverlay),
                this.scene.mask.removeEventListener("click", this.click),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.removeEventListener("dblclick", this.dblclick),
                d(t, "setRunningAction", this, 3)([!1]),
                e && e()
            }
        }])
    }(ni)
      , li = function(e) {
        console.log('----- PolygonDraw');
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            return i(this, t),
            (r = n(this, t, [e, o])).type = k.DRAWING_POLYGON,
            r.holeSource = null,
            r.isCotiHole = !1,
            r.scene.setCurrentDrawType(r.type),
            r.holeSource = o.holeSource || null,
            r.isCotiHole = o.isCotiHole || !1,
            r
        }
        return h(t, e),
        o(t, [{
            key: "setCotiHoleSource",
            value: function(e) {
                e && e instanceof BMapGL.Polygon && (this.holeSource = e)
            }
        }, {
            key: "holeCut",
            value: function(e) {
                if (this.holeSource && this.holeSource instanceof BMapGL.Polygon) {
                    var t = this.holeSource.getPath()
                      , n = e.getPath();
                    this.holeSource.hasMultipleParts ? t.push(n) : t = [t, n],
                    this.holeSource.setPath(t)
                }
            }
        }])
    }(ai)
      , hi = function(e) {
        function t(e, r, o, s, a) {
            var l;
            return i(this, t),
            (l = n(this, t)).scene = a,
            l.type = e,
            l.point = r,
            l.number = o,
            l.overlay = s,
            l
        }
        return h(t, e),
        o(t, [{
            key: "initialize",
            value: function(e) {
                this.map = e;
                var t, n = this.div = document.createElement("div");
                return n.className = "screenshot",
                "circle" === this.type ? t = '\n                <div class="circlShot">\n                <span id="screenshotNum">'.concat(this.number, '</span>\n                <input id="circleInput" type="text" />\n                <span class="unit">米</span>\n                </div>\n            ') : "rectangle" === this.type && (t = '\n                <div class="rectWH">\n                <div class="wh">\n                    <span id="rectWidth">'.concat(this.number.width, '</span>\n                    <input id="rectWidthInput" type="text" />\n                </div>\n                <span class="multiple">x</span>\n                <div class="wh">\n                    <span id="rectHeight">').concat(this.number.height, '</span>\n                    <input id="rectHeightInput" type="text" />\n                </div>\n                <span class="unit">米</span>\n                </div>\n            ')),
                n.innerHTML = t,
                n.addEventListener("mousemove", (function(e) {
                    D.preventDefault(e),
                    D.stopBubble(e)
                }
                )),
                n.addEventListener("dblclick", (function(e) {
                    D.preventDefault(e),
                    D.stopBubble(e)
                }
                )),
                this.map.getPanes().markerPane.appendChild(n),
                this.bind(),
                n
            }
        }, {
            key: "bind",
            value: function() {
                this.setNumber(this.number),
                "circle" === this.type ? this.bindCircleEvent() : this.bindRectEvent()
            }
        }, {
            key: "bindCircleEvent",
            value: function() {
                var e = this
                  , t = document.getElementById("screenshotNum")
                  , n = document.getElementById("circleInput");
                t.addEventListener("click", (function(e) {
                    var i = t.innerText;
                    t.style.display = "none",
                    n.value = i,
                    n.style.display = "inline-block",
                    n.focus()
                }
                )),
                n.addEventListener("click", (function(e) {
                    n.focus()
                }
                )),
                n.addEventListener("keydown", (function(i) {
                    if (13 === i.keyCode) {
                        var r = n.value;
                        n.style.display = "none",
                        t.innerText = r,
                        e.dispatchRadiusChange({
                            radius: r,
                            overlay: e.overlay
                        })
                    }
                }
                )),
                n.addEventListener("blur", (function(i) {
                    var r = n.value;
                    n.style.display = "none",
                    t.style.display = "inline-block",
                    t.innerText = r,
                    e.dispatchRadiusChange({
                        radius: r,
                        overlay: e.overlay
                    })
                }
                ))
            }
        }, {
            key: "bindRectEvent",
            value: function() {
                var e = this
                  , t = document.getElementById("rectWidth")
                  , n = document.getElementById("rectWidthInput")
                  , i = document.getElementById("rectHeight")
                  , r = document.getElementById("rectHeightInput");
                n.value = t.innerText,
                r.value = i.innerText,
                t.addEventListener("click", (function(e) {
                    var i = t.innerText;
                    t.style.display = "none",
                    n.value = i,
                    n.style.display = "inline-block",
                    n.focus()
                }
                )),
                i.addEventListener("click", (function(e) {
                    var t = i.innerText;
                    i.style.display = "none",
                    r.value = t,
                    r.style.display = "inline-block",
                    r.focus()
                }
                )),
                n.addEventListener("click", (function(e) {
                    n.focus()
                }
                )),
                r.addEventListener("click", (function(e) {
                    r.focus()
                }
                )),
                n.addEventListener("keydown", (function(o) {
                    if (13 === o.keyCode) {
                        var s = n.value
                          , a = r.value;
                        r.style.display = "none",
                        r.style.display = "none",
                        t.style.display = "inline-block",
                        r.style.display = "inline-block",
                        t.innerText = s,
                        i.innerText = a,
                        e.dispatchRectWHChange({
                            width: s,
                            height: a,
                            overlay: e.overlay
                        })
                    }
                }
                )),
                r.addEventListener("keydown", (function(o) {
                    if (13 === o.keyCode) {
                        var s = n.value
                          , a = r.value;
                        n.style.display = "none",
                        r.style.display = "none",
                        t.style.display = "inline-block",
                        i.style.display = "inline-block",
                        t.innerText = s,
                        i.innerText = a,
                        e.dispatchRectWHChange({
                            width: s,
                            height: a,
                            overlay: e.overlay
                        })
                    }
                }
                ))
            }
        }, {
            key: "setInfo",
            value: function(e, t) {
                this.setNumber(t),
                this.setPosition(e)
            }
        }, {
            key: "setNumber",
            value: function(e) {
                "circle" === this.type ? document.getElementById("screenshotNum").textContent = e : (document.getElementById("rectWidth").textContent = e.width,
                document.getElementById("rectHeight").textContent = e.height)
            }
        }, {
            key: "setPosition",
            value: function(e) {
                this.point = e;
                var t = this.type
                  , n = this.map.pointToOverlayPixel(this.point);
                "circle" === t ? (this.div.style.left = n.x - 30 + "px",
                this.div.style.top = n.y - 40 + "px") : "rectangle" === t && (this.div.style.left = n.x + "px",
                this.div.style.top = n.y - 45 + "px")
            }
        }, {
            key: "draw",
            value: function() {
                var e = this.map.pointToOverlayPixel(this.point);
                "circle" === this.type ? (this.div.style.left = e.x - 30 + "px",
                this.div.style.top = e.y - 40 + "px") : "rectangle" === this.type && (this.div.style.left = e.x + "px",
                this.div.style.top = e.y - 45 + "px")
            }
        }, {
            key: "dispatchRadiusChange",
            value: function(e) {
                var t = new T("radiuschange",e);
                this.dispatchEvent(t)
            }
        }, {
            key: "dispatchRectWHChange",
            value: function(e) {
                var t = new T("rectwhchange",e);
                this.dispatchEvent(t)
            }
        }])
    }(_(BMapGL.Overlay, F))
      , ci = function(e) {
        function t(e, r, o) {
            var s;
            return i(this, t),
            (s = n(this, t, [e, r, o])).type = k.DRAWING_RECTANGLE,
            s.scene.setCurrentDrawType(s.type),
            s
        }
        return h(t, e),
        o(t, [{
            key: "setIcon",
            value: function(e) {
                this.moveIcon = e
            }
        }, {
            key: "edit",
            value: function(e, t) {
                var n = this;
                this.overlay = e;
                for (var i = this.getBox(e.getPath()), r = i.startPoint, o = i.endPoint, s = [], a = this.getRectAllPoints(r, o), l = [], h = this.scene.map.getDistance(r, a[2]).toFixed(0), c = this.scene.map.getDistance(r, a[6]).toFixed(0), u = new hi("rectangle",a[0],{
                    width: h,
                    height: c
                },e,this.scene), p = 0; a.length > p; p++) {
                    var v = new BMapGL.Marker(a[p]);
                    v.setIcon(this.target && this.target.moveIcon ? this.target.moveIcon : this.moveIcon),
                    v.enableDragging(),
                    s.push(v),
                    this.scene.map.addOverlay(v),
                    l[p] = D.mc2ll(v.point, this.scene.map),
                    v.addEventListener("mousedown", (function(e) {
                        o = D.mc2ll(e.target.point, n.scene.map)
                    }
                    )),
                    v.addEventListener("dragging", (function(t) {
                        for (var i = t.latLng, r = 0; l.length > r; r++)
                            o.lng == l[r].lng && (a[r].lng = i.lng),
                            o.lat == l[r].lat && (a[r].lat = i.lat);
                        a = n.getRectAllPoints(a[0], a[4]);
                        for (var p = 0; s.length > p; p++)
                            s[p].setPosition(a[p]);
                        h = n.scene.map.getDistance(a[0], a[2]).toFixed(0),
                        c = n.scene.map.getDistance(a[0], a[6]).toFixed(0),
                        u.setInfo(a[0], {
                            width: h,
                            height: c
                        }),
                        d.setPosition(a[3], !0),
                        e.setPath(a)
                    }
                    )),
                    v.addEventListener("dragend", (function(t) {
                        for (var i = 0; s.length > i; i++) {
                            l[i] = D.mc2ll(s[i].point, n.scene.map)
                        }
                        d.updateWindow();
                        var r = new T(b.CHANGE,e);
                        n.target.dispatchEvent(r)
                    }
                    ))
                }
                u.addEventListener("rectwhchange", (function(t) {
                    var i = t.target.width
                      , r = t.target.height
                      , o = D.getPointByDistance(a[0], i, "east")
                      , h = D.getPointByDistance(a[0], r, "south");
                    a[4].lng = o.lng,
                    a[4].lat = h.lat,
                    a = n.getRectAllPoints(a[0], a[4]);
                    for (var c = 0; s.length > c; c++)
                        s[c].setPosition(a[c]);
                    u.setInfo(a[0], {
                        width: i,
                        height: r
                    }),
                    d.setPosition(a[3], !0),
                    e.setPath(a);
                    for (var p = 0; s.length > p; p++) {
                        l[p] = D.mc2ll(s[p].point, n.scene.map)
                    }
                    d.updateWindow();
                    var v = new T(b.CHANGE,e);
                    n.target.dispatchEvent(v)
                }
                ));
                this.overlays = [s, u];
                var d = this.addOperateWindow({
                    limit: t,
                    point: a[3],
                    overlay: e
                });
                this.scene.map.addOverlay(u),
                this.dispatchEvent(new T(b.INIT)),
                this.onlinevertexdragging = function(e) {
                    var t, i = e.overlay, r = BMapGL.Projection.convertMC2LL(i.getPoint());
                    (t = n.getSnap(r, n.scene.instances)) && (e.from.point = BMapGL.Projection.convertLL2MC(t),
                    i.setPoint(e.from.point))
                }
                ,
                e.addEventListener("onlinevertexdragging", this.onlinevertexdragging)
            }
        }, {
            key: "getBox",
            value: function(e) {
                var t = 1 / 0
                  , n = -1 / 0
                  , i = -1 / 0
                  , r = 1 / 0;
                return e.forEach((function(e) {
                    t > e.lng && (t = e.lng),
                    e.lat > n && (n = e.lat),
                    e.lng > i && (i = e.lng),
                    r > e.lat && (r = e.lat)
                }
                )),
                {
                    startPoint: new BMapGL.Point(t,n),
                    endPoint: new BMapGL.Point(i,r)
                }
            }
        }, {
            key: "getRectAllPoints",
            value: function(e, t) {
                var n = new BMapGL.Point(e.lng,e.lat)
                  , i = new BMapGL.Point(t.lng,e.lat)
                  , r = new BMapGL.Point(t.lng,t.lat)
                  , o = new BMapGL.Point(e.lng,t.lat);
                return [n, new BMapGL.Point((e.lng + t.lng) / 2,e.lat), i, new BMapGL.Point(t.lng,(e.lat + t.lat) / 2), r, new BMapGL.Point((e.lng + t.lng) / 2,t.lat), o, new BMapGL.Point(e.lng,(e.lat + t.lat) / 2)]
            }
        }, {
            key: "getRectanglePoint",
            value: function(e, t) {
                return [new BMapGL.Point(e.lng,e.lat), new BMapGL.Point(t.lng,e.lat), new BMapGL.Point(t.lng,t.lat), new BMapGL.Point(e.lng,t.lat)]
            }
        }])
    }(ri)
      , ui = function(e) {
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            return i(this, t),
            (r = n(this, t, [e, o])).type = k.DRAWING_RECTANGLE,
            r.polygon = null,
            r.startPoint = null,
            r.hideTip = !1,
            r.holeSource = null,
            r.isCotiHole = !1,
            r.scene.setCurrentDrawType(r.type),
            r.moveIcon = new BMapGL.Icon(M,new BMapGL.Size(10,10)),
            r.moveIcon.setImageSize(new BMapGL.Size(10,10)),
            o.hideTip && (r.hideTip = o.hideTip),
            r.isOpen && r.open(),
            r.holeSource = o.holeSource || null,
            r.isCotiHole = o.isCotiHole || !1,
            r
        }
        return h(t, e),
        o(t, [{
            key: "getRectAllPoints",
            value: function(e, t) {
                var n = new BMapGL.Point(e.lng,e.lat)
                  , i = new BMapGL.Point(t.lng,e.lat)
                  , r = new BMapGL.Point(t.lng,t.lat)
                  , o = new BMapGL.Point(e.lng,t.lat);
                return [n, new BMapGL.Point((e.lng + t.lng) / 2,e.lat), i, new BMapGL.Point(t.lng,(e.lat + t.lat) / 2), r, new BMapGL.Point((e.lng + t.lng) / 2,t.lat), o, new BMapGL.Point(e.lng,(e.lat + t.lat) / 2)]
            }
        }, {
            key: "getRectanglePoint",
            value: function(e, t) {
                return [new BMapGL.Point(e.lng,e.lat), new BMapGL.Point(t.lng,e.lat), new BMapGL.Point(t.lng,t.lat), new BMapGL.Point(e.lng,t.lat)]
            }
        }, {
            key: "startAction",
            value: function(e) {
                if (!this.scene.getStopStatus() && 4 !== e.buttons) {
                    D.stopBubble(e),
                    D.preventDefault(e);
                    var t = this.startPoint = e.point;
                    this.enableSnap && this.match && (t = this.startPoint = this.match),
                    this.deletable = !0;
                    var n = this.endPoint = t;
                    this.polygon = new BMapGL.Polygon(this.getRectanglePoint(t, n),this.baseOptions),
                    this.scene.map.addOverlay(this.polygon),
                    this.scene.mask.enableEdgeMove(),
                    this.scene.mask.removeEventListener("mousedown", this.mousedown),
                    this.scene.mask.removeEventListener("mousemove", this.mousemove),
                    this.scene.mask.addEventListener("mousemove", this.mousemove = this.moveAction.bind(this)),
                    this.scene.mask.addEventListener("mouseup", this.mouseup = this.endAction.bind(this))
                }
            }
        }, {
            key: "moveAction",
            value: function(e) {
                if (this.scene.map.removeOverlay(this.tipLabel),
                !this.scene.getStopStatus())
                    if (this.enableSnap && (this.match = this.getSnap(e.point, this.scene.instances),
                    this.match))
                        this.polygon.setPath(this.getRectanglePoint(this.startPoint, this.match));
                    else {
                        this.match = null,
                        this.polygon.setPath(this.getRectanglePoint(this.startPoint, e.point));
                        var t = this.getRectAllPoints(this.startPoint, e.point)
                          , n = this.scene.map.getDistance(this.startPoint, t[2]).toFixed(0)
                          , i = this.scene.map.getDistance(this.startPoint, t[6]).toFixed(0);
                        this.hideTip || (this.tipLabel = new BMapGL.Label("尺寸：" + n + "米 x " + i + "米<br>松开结束绘制",{
                            position: e.point,
                            offset: new BMapGL.Size(10,10)
                        }),
                        this.tipLabel.setStyle(this.options.labelOptions),
                        this.scene.map.addOverlay(this.tipLabel))
                    }
            }
        }, {
            key: "endAction",
            value: function(e) {
                if (!this.scene.getStopStatus())
                    if (this.deletable = !1,
                    this.scene.map.removeOverlay(this.tipLabel),
                    this.scene.mask.removeEventListener("mousemove", this.mousemove),
                    this.scene.mask.removeEventListener("mouseup", this.mouseup),
                    this.scene.mask.disableEdgeMove(),
                    this.enableSnap ? (this.match = this.getSnap(e.point, this.scene.instances),
                    this.match && this.polygon.setPath(this.getRectanglePoint(this.startPoint, this.match))) : this.polygon.setPath(this.getRectanglePoint(this.startPoint, e.point)),
                    this.isSeries ? this.isOnMap || this.bindEvent() : this.scene.mask.hide(),
                    this.isOnMap) {
                        var t = null;
                        this.options.limit && (t = this.options.limit.area);
                        var n = this.editOpe = new ci(this.scene,this);
                        this.registEvent(n),
                        n.open(this.polygon, t)
                    } else
                        this.scene.map.removeOverlay(this.polygon),
                        this.isCotiHole && this.holeCut && this.holeCut(this.polygon),
                        this.emitEventIsnomap(this.polygon)
            }
        }, {
            key: "setCotiHoleSource",
            value: function(e) {
                e && e instanceof BMapGL.Polygon && (this.holeSource = e)
            }
        }, {
            key: "holeCut",
            value: function(e) {
                if (this.holeSource && this.holeSource instanceof BMapGL.Polygon) {
                    var t = this.holeSource.getPath()
                      , n = e.getPath();
                    this.holeSource.hasMultipleParts ? t.push(n) : t = [t, n],
                    this.holeSource.setPath(t)
                }
            }
        }, {
            key: "mousemoveAction",
            value: function(e) {
                this.scene.getStopStatus() ? this.scene.map.removeOverlay(this.tipLabel) : (4 !== e.buttons && (D.preventDefault(e),
                D.stopBubble(e)),
                this.enableSnap && (this.match = this.getSnap(e.point, this.scene.instances)),
                this.scene.map.removeOverlay(this.tipLabel),
                this.hideTip || (this.tipLabel = new BMapGL.Label("按住确认起点，拖拽进行绘制",{
                    position: e.point,
                    offset: new BMapGL.Size(10,10)
                }),
                this.tipLabel.setStyle(this.options.labelOptions),
                this.scene.map.addOverlay(this.tipLabel)))
            }
        }, {
            key: "bindEvent",
            value: function() {
                var e = this;
                this.isOpen && d(t, "setRunningAction", this, 3)([!0, function() {
                    e.setCurrentStatus(y.STATUS_DRAWING),
                    e.deletable = !1,
                    e.mousedown && e.mousemove && (e.scene.mask.removeEventListener("mousedown", e.mousedown),
                    e.scene.mask.removeEventListener("mousemove", e.mousemove)),
                    e.scene.mask.addEventListener("mousemove", e.mousemove = e.mousemoveAction.bind(e)),
                    e.scene.mask.addEventListener("mousedown", e.mousedown = e.startAction.bind(e))
                }
                ])
            }
        }, {
            key: "removeDrawing",
            value: function() {
                this.deletable && this.scene.map.removeOverlay(this.polygon)
            }
        }, {
            key: "close",
            value: function(e) {
                this.deletable = !1,
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.map.removeOverlay(this.matchOverlay),
                this.scene.mask.removeEventListener("mouseup", this.mouseup),
                this.scene.mask.removeEventListener("mousedown", this.mousedown),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                d(t, "setRunningAction", this, 3)([!1]),
                e && e()
            }
        }])
    }(ni)
      , pi = function(e) {
        function t(e, r, o) {
            var s;
            return i(this, t),
            (s = n(this, t, [e, r, o])).type = k.DRAWING_CIRCLE,
            s.scene.setCurrentDrawType(s.type),
            s
        }
        return h(t, e),
        o(t, [{
            key: "setCenterIcon",
            value: function(e) {
                this.centerIcon = e
            }
        }, {
            key: "setMoveIcon",
            value: function(e) {
                this.moveIcon = e
            }
        }, {
            key: "edit",
            value: function(e, t) {
                var n = this;
                this.overlay = e,
                this.centerPoint = e.getCenterIn().latLng;
                var i = new BMapGL.Point(e.getBounds().getNorthEast().lng,this.centerPoint.lat)
                  , r = this.centerMarker = new BMapGL.Marker(this.centerPoint);
                r.setIcon(this.centerIcon),
                r.enableDragging(),
                r.addEventListener("dragstart", this.centerDragstart.bind(this)),
                r.addEventListener("dragging", this.centerDragging.bind(this)),
                r.addEventListener("dragend", this.centerDragend.bind(this)),
                this.scene.map.addOverlay(r);
                var o = this.moveMarker = new BMapGL.Marker(i);
                o.setIcon(this.circleMoveIcon),
                o.enableDragging();
                var s = this.polyline = new BMapGL.Polyline([this.centerPoint, i],this.baseOptions || {})
                  , a = new BMapGL.Point((e.getBounds().getNorthEast().lng + this.centerPoint.lng) / 2,this.centerPoint.lat)
                  , l = this.radiusWindow = new hi("circle",a,Math.ceil(e.getRadius()),e,this.scene);
                this.overlays = [r, o, s, l];
                var h = this.operateWindow = this.addOperateWindow({
                    limit: t,
                    point: i,
                    overlay: e
                });
                this.scene.map.addOverlay(o),
                this.scene.map.addOverlay(s),
                this.scene.map.addOverlay(l);
                var c = 1;
                l.addEventListener("radiuschange", (function(t) {
                    if (t.target.radius && !isNaN(t.target.radius)) {
                        e.setRadius(c = t.target.radius);
                        var i = D.getPointByDistance(n.centerPoint, c, "east")
                          , r = new BMapGL.Point(i.lng,n.centerPoint.lat)
                          , a = i.lng > n.centerPoint.lng ? (e.getBounds().getNorthEast().lng + n.centerPoint.lng) / 2 : (e.getBounds().getSouthWest().lng + n.centerPoint.lng) / 2
                          , u = new BMapGL.Point(a,n.centerPoint.lat);
                        o.setPosition(r),
                        l.setInfo(u, c),
                        h.setPosition(r, !0),
                        h.updateWindow(),
                        s.setPath([n.centerPoint, r]);
                        var p = new T(b.CHANGE,e);
                        n.target.dispatchEvent(p)
                    }
                }
                )),
                o.addEventListener("dragging", (function(t) {
                    var i = new BMapGL.Point(t.latLng.lng,n.centerPoint.lat)
                      , r = t.latLng.lng > n.centerPoint.lng ? (e.getBounds().getNorthEast().lng + n.centerPoint.lng) / 2 : (e.getBounds().getSouthWest().lng + n.centerPoint.lng) / 2
                      , o = t.latLng.lng > n.centerPoint.lng
                      , a = new BMapGL.Point(r,n.centerPoint.lat);
                    t.target.setPosition(i),
                    l.setInfo(a, n.scene.map.getDistance(n.centerPoint, t.latLng).toFixed(0)),
                    h.setPosition(i, o),
                    s.setPath([n.centerPoint, i]),
                    c = n.scene.map.getDistance(n.centerPoint, t.latLng).toFixed(0),
                    e.setRadius(n.scene.map.getDistance(n.centerPoint, t.latLng))
                }
                )),
                o.addEventListener("dragend", (function(t) {
                    h.updateWindow();
                    var i = new T(b.CHANGE,e);
                    n.target.dispatchEvent(i)
                }
                )),
                this.dispatchEvent(new T(b.INIT))
            }
        }, {
            key: "centerDragstart",
            value: function(e) {
                this.moveMarker.hide(),
                this.polyline.hide(),
                this.radiusWindow.hide(),
                this.operateWindow.hide()
            }
        }, {
            key: "centerDragging",
            value: function(e) {
                this.centerPoint = e.latLng,
                this.overlay.setCenter(e.latLng)
            }
        }, {
            key: "centerDragend",
            value: function(e) {
                this.centerPoint = e.latLng;
                var t = new BMapGL.Point(this.overlay.getBounds().getNorthEast().lng,this.centerPoint.lat);
                this.moveMarker.setPosition(t),
                this.moveMarker.show();
                var n = new BMapGL.Point(this.overlay.getBounds().getNorthEast().lng,this.centerPoint.lat);
                this.polyline.setPath([this.centerPoint, n]),
                this.polyline.show();
                var i = (this.overlay.getBounds().getNorthEast().lng + this.centerPoint.lng) / 2
                  , r = new BMapGL.Point(i,this.centerPoint.lat);
                this.radiusWindow.setPosition(r),
                this.operateWindow.setPosition(n, !0),
                this.radiusWindow.show(),
                this.operateWindow.show();
                var o = new T(b.CHANGE,this.circle);
                this.target.dispatchEvent(o)
            }
        }])
    }(ri)
      , vi = function(e) {
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            return i(this, t),
            (r = n(this, t, [e, o])).type = k.DRAWING_CIRCLE,
            r.circle = null,
            r.overlays = [],
            r.centerPoint = null,
            r.radius = 1,
            r.moveMarker = null,
            r.polyline = null,
            r.radiusWindow = null,
            r.operateWindow = null,
            r.hideTip = !1,
            r.scene.setCurrentDrawType(r.type),
            o.hideTip && (r.hideTip = o.hideTip),
            r.isOpen && r.open(),
            r
        }
        return h(t, e),
        o(t, [{
            key: "startAction",
            value: function(e) {
                this.scene.getStopStatus() || (this.centerPoint = e.point,
                this.deletable = !0,
                this.circle = new BMapGL.Circle(this.centerPoint,this.radius,this.baseOptions),
                this.scene.map.addOverlay(this.circle),
                this.scene.mask.enableEdgeMove(),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.addEventListener("mousemove", this.mousemove = this.moveAction.bind(this)),
                this.scene.mask.addEventListener("mouseup", this.mouseup = this.endAction.bind(this)))
            }
        }, {
            key: "moveAction",
            value: function(e) {
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.getStopStatus() || (this.radius = this.scene.map.getDistance(this.centerPoint, e.point).toFixed(0),
                this.circle.setRadius(this.radius),
                this.hideTip || (this.tipLabel = new BMapGL.Label("半径：" + this.radius + "米<br>松开完成绘制",{
                    position: e.point,
                    offset: new BMapGL.Size(10,10)
                }),
                this.tipLabel.setStyle(this.options.labelOptions),
                this.scene.map.addOverlay(this.tipLabel)))
            }
        }, {
            key: "endAction",
            value: function(e) {
                if (!this.scene.getStopStatus())
                    if (this.deletable = !1,
                    this.scene.map.removeOverlay(this.tipLabel),
                    this.scene.mask.disableEdgeMove(),
                    this.scene.mask.removeEventListener("mousemove", this.mousemove),
                    this.scene.mask.removeEventListener("mouseup", this.mouseup),
                    this.isSeries ? this.isOnMap || this.bindEvent() : this.scene.mask.hide(),
                    this.isOnMap) {
                        var t = null;
                        this.limit && (t = this.limit.area);
                        var n = this.editOpe = new pi(this.scene,this);
                        this.registEvent(n),
                        n.open(this.circle, t)
                    } else
                        this.scene.map.removeOverlay(this.centerMarker),
                        this.scene.map.removeOverlay(this.circle),
                        this.emitEventIsnomap(this.circle)
            }
        }, {
            key: "mousedownAction",
            value: function(e) {
                this.scene.getStopStatus() || 4 !== e.buttons && (D.preventDefault(e),
                D.stopBubble(e),
                this.scene.mask.removeEventListener("mousedown", this.mousedown),
                null == this.centerPoint && this.startAction(e))
            }
        }, {
            key: "mousemoveAction",
            value: function(e) {
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.getStopStatus() || (4 !== e.buttons && (D.preventDefault(e),
                D.stopBubble(e)),
                this.hideTip || (this.tipLabel = new BMapGL.Label("按下确认中心点，拖拽确认半径",{
                    position: e.point,
                    offset: new BMapGL.Size(10,10)
                }),
                this.tipLabel.setStyle(this.options.labelOptions),
                this.scene.map.addOverlay(this.tipLabel)))
            }
        }, {
            key: "bindEvent",
            value: function() {
                var e = this;
                this.isOpen && d(t, "setRunningAction", this, 3)([!0, function() {
                    e.centerPoint = null,
                    e.radius = 1,
                    e.setCurrentStatus(y.STATUS_DRAWING),
                    e.deletable = !1,
                    e.mousedown && e.mousemove && (e.scene.mask.removeEventListener("mousedown", e.mousedown),
                    e.scene.mask.removeEventListener("mousemove", e.mousemove)),
                    e.scene.mask.addEventListener("mousemove", e.mousemove = e.mousemoveAction.bind(e)),
                    e.scene.mask.addEventListener("mousedown", e.mousedown = e.mousedownAction.bind(e))
                }
                ])
            }
        }, {
            key: "removeDrawing",
            value: function() {
                this.deletable && this.scene.map.removeOverlay(this.circle)
            }
        }, {
            key: "close",
            value: function(e) {
                this.deletable = !1,
                d(t, "setRunningAction", this, 3)([!1]),
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.mask.removeEventListener("mouseup", this.mouseup),
                this.scene.mask.removeEventListener("mousedown", this.mousedown),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                e && e()
            }
        }])
    }(ni)
      , di = function(e) {
        function t(e, r, o) {
            var s;
            return i(this, t),
            (s = n(this, t, [e, r, o])).type = k.DRAWING_MARKER,
            s.scene.setCurrentDrawType(s.type),
            s
        }
        return h(t, e),
        o(t, [{
            key: "setIcon",
            value: function(e) {
                this.moveIcon = e
            }
        }, {
            key: "edit",
            value: function(e) {
                e.enableDragging(),
                e.addEventListener("dragstart", this.centerDragstart.bind(this)),
                e.addEventListener("dragging", this.centerDragging.bind(this)),
                e.addEventListener("dragend", this.centerDragend.bind(this))
            }
        }, {
            key: "centerDragstart",
            value: function(e) {}
        }, {
            key: "centerDragging",
            value: function(e) {
                var t, n = e.target, i = BMapGL.Projection.convertMC2LL(n.point);
                (t = this.getSnap(i, this.scene.instances)) && (e.point = BMapGL.Projection.convertLL2MC(t),
                n.setPoint(e.point))
            }
        }, {
            key: "centerDragend",
            value: function(e) {
                this.emitOkEvent(this.overlay, !0, !0);
                var t = new T(b.CHANGE,this.overlay);
                this.target.dispatchEvent(t)
            }
        }, {
            key: "closeOpe",
            value: function(e) {
                e.disableDragging(),
                e.removeEventListener("dragstart", this.centerDragstart),
                e.removeEventListener("dragging", this.centerDragging),
                e.removeEventListener("dragend", this.centerDragend)
            }
        }])
    }(ri)
      , fi = function() {
        function e(t) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            return i(this, e),
            (r = n(this, e)).scene = t,
            r.opts = o,
            r.drawingItems = o.drawingItems || N,
            r.defaultAnchor = o.anchor || BMAP_ANCHOR_TOP_LEFT,
            r.defaultOffset = o.offset || new BMapGL.Size(20,20),
            r.initialize(r.scene.map),
            r
        }
        return h(e, BMapGL.Control),
        o(e, [{
            key: "initialize",
            value: function(e) {
                this._map = e;
                var t = this.container = document.createElement("div");
                t.className = "BMap_Drawing";
                var n = this.panel = document.createElement("div");
                n.className = "BMap_Draw_Panel",
                t.appendChild(n);
                var i = this.generalHtml(e);
                n.appendChild(i);
                var r = this.tip = document.createElement("div");
                return r.className = "BMapDraw_tip",
                r.innerHTML = '<p class="BMapDraw_tip_title"></p><p class="BMapDraw_tip_text"></p>',
                this.opts.enableTips && n.appendChild(r),
                e.getContainer().appendChild(t),
                this.bindEvt(),
                t
            }
        }, {
            key: "generalHtml",
            value: function(e) {
                for (var t = this, n = {
                    hander: "拖动地图",
                    marker: "标记点",
                    polyline: "折线",
                    polygon: "多边形",
                    circle: "圆形",
                    rectangle: "矩形"
                }, i = function(e, i) {
                    var r = document.createElement("a");
                    return r.className = e,
                    r.href = "javascript:void(0)",
                    r.setAttribute("drawingType", i),
                    r.setAttribute("onfocus", "this.blur()"),
                    r.addEventListener("mouseenter", (function(e) {
                        var i = e.target.getAttribute("drawingType")
                          , r = n[i];
                        "hander" === i ? (t.tip.children[0].innerText = r,
                        t.tip.children[1].innerText = "使用鼠标拖动地图") : (t.tip.className += " " + i,
                        t.tip.children[0].innerText = r,
                        t.tip.children[1].innerText = "使用" + r + "选出目标区域"),
                        t.tip.style.display = "block"
                    }
                    )),
                    r.addEventListener("mouseleave", (function(e) {
                        for (var n = e.target.getAttribute("drawingType"), i = " " + t.tip.className.replace(/[\t\r\n]/g, "") + " "; i.indexOf(" " + n + " ") >= 0; )
                            i = i.replace(" " + n + " ", " ");
                        t.tip.className = i.replace(/^\s+|\s+$/g, ""),
                        t.tip.style.display = "none"
                    }
                    )),
                    r
                }, r = document.createDocumentFragment(), o = 0, s = this.drawingItems.length; s > o; o++) {
                    r.appendChild(i("BMapDraw_Box BMapDraw_" + this.drawingItems[o], this.drawingItems[o]))
                }
                return r
            }
        }, {
            key: "setStyleByDrawingItems",
            value: function() {
                for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "marker", t = this.panel.getElementsByTagName("a"), n = 0, i = t.length; i > n; n++) {
                    var r = t[n];
                    if (r.getAttribute("drawingType") === e)
                        r.className = "BMapDraw_Box BMapDraw_" + e + "_hover";
                    else
                        r.className = r.className.replace(/_hover/, "")
                }
            }
        }, {
            key: "bindEventByDrawingType",
            value: function(e) {
                var t = this.scene;
                if (t.isOpen && t.drawType === e)
                    t.close(),
                    t.map.enableDoubleClickZoom();
                else
                    switch (e) {
                    case "marker":
                        new ii(t).open();
                        break;
                    case "polyline":
                        new ai(t).open();
                        break;
                    case "polygon":
                        new li(t).open();
                        break;
                    case "circle":
                        new vi(t).open();
                        break;
                    case "rectangle":
                        new ui(t).open()
                    }
            }
        }, {
            key: "bindEvt",
            value: function(e) {
                var t = this;
                D.on(this.panel, "click", (function(e) {
                    var n = D.getTarget(e).getAttribute("drawingType");
                    t.setStyleByDrawingItems(n),
                    t.bindEventByDrawingType(n)
                }
                ))
            }
        }])
    }()
      , gi = function(e) {
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            return i(this, t),
            (r = n(this, t)).type = null,
            r.instance = null,
            r.graphicOpts = I,
            r.labelOptions = P,
            r.isOnMap = !1,
            r.isSeries = !1,
            r.skipEditing = !1,
            r.mouseMove = !0,
            r.enableSnap = !1,
            r.limitPoint = -1,
            r.scene = e,
            r.defineProperty(o),
            r
        }
        return h(t, e),
        o(t, [{
            key: "close",
            value: function(e) {
                this.instance && (this.instance.close(),
                this.instance = null),
                e && e()
            }
        }, {
            key: "open",
            value: function(e) {
                this.close(),
                this.scene.close(),
                this.defineProperty(e),
                this.type && this.doAction()
            }
        }, {
            key: "doAction",
            value: function() {
                var e = this;
                this.data = [];
                var t = {
                    isSelectDraw: !0,
                    isOpen: !0,
                    enableSnap: this.enableSnap,
                    isOnMap: this.isOnMap,
                    isSeries: this.isSeries,
                    skipEditing: this.skipEditing,
                    labelOptions: this.labelOptions,
                    baseOpts: this.graphicOpts,
                    mouseMove: this.mouseMove,
                    limitPoint: this.limitPoint
                };
                switch (this.type) {
                case k.DRAWING_POLYLINE:
                    this.instance = new ai(this.scene,t);
                    break;
                case k.DRAWING_POLYGON:
                    this.instance = new li(this.scene,t);
                    break;
                case k.DRAWING_RECTANGLE:
                    this.instance = new ui(this.scene,t);
                    break;
                case k.DRAWING_CIRCLE:
                    this.instance = new vi(this.scene,t);
                    break;
                case k.DRAWING_MARKER:
                    this.instance = new ii(this.scene,t);
                    break;
                case k.DRAWING_POINT:
                    this.instance = new W(this.scene.map);
                    break;
                default:
                    this.close()
                }
                this.instance && (this.instance.addEventListener(b.CHANGE, (function(t) {
                    e.dispatchEvent(t)
                }
                )),
                this.instance.addEventListener(b.MOVE, (function(t) {
                    e.dispatchEvent(t)
                }
                )),
                this.instance.addEventListener(b.CLICK, (function(t) {
                    e.dispatchEvent(t);
                    var n = new T(b.COMPLETE,{
                        from: E.SELECT_NO_MAP,
                        mouseTarget: t.target,
                        overlay: new BMapGL.Marker(new BMapGL.Point(t.target.latlng.lng,t.target.latlng.lat))
                    });
                    e.scene.dispatchEvent(n)
                }
                )),
                this.instance.addEventListener(b.COMPLETE, (function(t) {
                    e.dispatchEvent(t)
                }
                )),
                this.instance.addEventListener(b.CANCEL, (function(t) {
                    e.dispatchEvent(t)
                }
                )))
            }
        }, {
            key: "addData",
            value: function(e) {
                this.scene && this.scene.addSelectDrawData(e)
            }
        }, {
            key: "clearData",
            value: function() {
                this.scene && this.scene.clearSelectDrawData()
            }
        }])
    }(F)
      , mi = function() {
        return o((function e(t, n) {
            i(this, e),
            this.label = void 0,
            this.scene = t
        }
        ), [{
            key: "getLength",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {
                    showlabel: !0,
                    unit: "kilometers"
                };
                e instanceof BMapGL.Polyline && (e = e.toGeoJSON());
                var n = Kn.getLength(e);
                if (t.showlabel) {
                    var i = e.geometry.coordinates
                      , r = new BMapGL.Point(i[i.length - 1][0],i[i.length - 1][1])
                      , o = "";
                    switch (t.unit) {
                    case "kilometers":
                        o = "总长度：" + n.toFixed(2) + "km";
                        break;
                    case "meters":
                        o = "总长度：" + n.toFixed(2) + "m"
                    }
                    this.scene.map.removeOverlay(this.label),
                    this.label = new BMapGL.Label(o,{
                        position: r,
                        offset: t.offset || new BMapGL.Size(0,0)
                    }),
                    this.label.setStyle(t.labelOptions),
                    this.scene.map.addOverlay(this.label)
                }
                return n
            }
        }, {
            key: "getPolygonArea",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {
                    showlabel: !0,
                    unit: "kilometers"
                };
                e instanceof BMapGL.Polygon && (e = e.toGeoJSON());
                var n = Kn.getPolygonArea(e);
                if (t.showlabel) {
                    var i = Kn.getPolygonCenter(e)
                      , r = "";
                    switch (t.unit) {
                    case "kilometers":
                        r = n.toFixed(2) + " km²";
                        break;
                    case "meters":
                        r = n.toFixed(2) + " m²"
                    }
                    this.scene.map.removeOverlay(this.label),
                    this.label = new BMapGL.Label(r,{
                        position: i.bdCenter,
                        offset: t.offset || new BMapGL.Size(-20,-10)
                    }),
                    this.label.setStyle(t.labelOptions),
                    this.scene.map.addOverlay(this.label)
                }
                return n
            }
        }])
    }()
      , yi = function(e) {
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            return i(this, t),
            (r = n(this, t, [e, o])).tipLabel = null,
            r.lengthLabel = [],
            r.totalLabel = null,
            r.turnOverlays = [],
            r.totalLength = 0,
            r.measureRes = 0,
            r.subDistance = [],
            r.scene.setCurrentDrawType(r.type),
            r.setOtherOptions(o),
            r.isOpen && r.open(),
            r
        }
        return h(t, e),
        o(t, [{
            key: "setOtherOptions",
            value: function(e) {
                this.options = e,
                this.skipEditing = !0,
                this.isOpen = !0,
                this.options = Object.assign(C, e),
                this.isSeries = this.options.isSeries,
                this.setBaseOptions(this.options.baseOpts)
            }
        }, {
            key: "setTurnPoint",
            value: function(e) {
                var t = this.options
                  , n = new BMapGL.Marker(e,{
                    icon: t.turnIcon ? t.turnIcon : x,
                    clickable: !1,
                    baseZIndex: 35e5,
                    zIndexFixed: !0
                });
                this.scene.map.addOverlay(n),
                this.turnOverlays.push(n)
            }
        }, {
            key: "startAction",
            value: function(e) {
                var t = this.match ? this.match : e.point;
                this.points.push(t),
                this.drawPoint = this.points.concat(this.points[this.points.length - 1]),
                1 === this.points.length ? (this.turnOverlays = [],
                this.lengthLabel = [],
                this.overlay = new BMapGL.Polyline(this.drawPoint,this.baseOptions),
                this.scene.map.addOverlay(this.overlay)) : (this.overlay.setPath(this.drawPoint),
                this.scene.map.removeOverlay(this.measureLabel),
                this.scene.map.addOverlay(this.downLabel),
                this.subDistance.push(this.downLabel.content),
                this.lengthLabel.push(this.downLabel)),
                this.setTurnPoint(t),
                this.isBinded || (this.isBinded = !0,
                this.scene.mask.enableEdgeMove(),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.addEventListener("mousemove", this.mousemove = this.moveAction.bind(this)),
                this.scene.mask.addEventListener("dblclick", this.dblclick = this.dblclickAction.bind(this)))
            }
        }, {
            key: "moveAction",
            value: function(e) {
                var t = e.point;
                if (this.enableSnap) {
                    var n = [];
                    if (this.overlay.points.length > 2) {
                        var i = this.overlay.getPath().slice(0, this.overlay.points.length - 1);
                        n.push(new this.overlay.constructor(i))
                    }
                    if (this.match = this.getSnap(t, this.scene.instances, n),
                    this.match)
                        return void this.overlay.setPositionAt(this.drawPoint.length - 1, this.match)
                }
                this.match = null;
                var r = this.drawPoint[this.drawPoint.length - 2]
                  , o = e.point;
                "metric" === this.options.unit ? (this.measureRes = 1e3 * Kn.getDistance(r, o),
                this.distance = this.measureRes.toFixed(2) + "m") : (this.measureRes = Kn.getDistance(r, o),
                this.distance = this.measureRes.toFixed(2) + "km");
                var s = Kn.getLineCenter(r, o);
                this.scene.map.removeOverlay(this.measureLabel),
                this.measureLabel = this.addLabel(this.distance, {
                    position: s.bdCenter
                }),
                this.downLabel = this.addLabel(this.distance, {
                    position: s.bdCenter
                }),
                this.scene.map.addOverlay(this.measureLabel),
                this.overlay.setPositionAt(this.drawPoint.length - 1, e.point),
                this.scene.map.removeOverlay(this.tipLabel),
                this.tipLabel = new BMapGL.Label(this.options.followLabel,{
                    position: e.point,
                    offset: new BMapGL.Size(10,10)
                }),
                this.tipLabel.setStyle(this.options.labelOptions),
                this.scene.map.addOverlay(this.tipLabel)
            }
        }, {
            key: "dblclickAction",
            value: function(e) {
                var t = this;
                D.preventDefault(e),
                D.stopBubble(e),
                this.isBinded = !1,
                this.scene.map.removeOverlay(this.matchOverlay),
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.mask.disableEdgeMove(),
                this.scene.mask.removeEventListener("mousedown", this.mousedown),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.removeEventListener("dblclick", this.dblclick);
                var n = this.overlay.toGeoJSON()
                  , i = n.geometry.coordinates
                  , r = new BMapGL.Point(i[i.length - 1][0],i[i.length - 1][1])
                  , o = [0, 0]
                  , s = [0, 0]
                  , a = this.scene.map.pointToPixel(this.points[this.points.length - 2])
                  , l = this.scene.map.pointToPixel(this.points[this.points.length - 3]);
                o = 0 > a.x - l.x ? [-14, 0] : [14, 0],
                s = 0 > a.y - l.y ? [-5, -38] : [-5, 11];
                var h = Kn.getLength(n, "kilometers");
                this.totalLength = "metric" === this.options.unit ? 1e3 * h : h;
                var c = "";
                switch (this.options.unit) {
                case "kilometers":
                    c = "总长：" + h.toFixed(2) + "km";
                    break;
                case "metric":
                    c = "总长：" + 1e3 * h.toFixed(2) + "m"
                }
                this.totalLabel = new BMapGL.Label(c,{
                    position: r,
                    offset: new BMapGL.Size(s[0],s[1])
                }),
                this.totalLabel.setStyle(this.options.labelOptions),
                this.scene.map.addOverlay(this.totalLabel),
                this.lengthLabel.push(this.totalLabel),
                this.closeIcon = this.options.closeIcon ? this.options.closeIcon : L,
                this.closeBtn = new BMapGL.Marker(r,{
                    icon: this.closeIcon,
                    baseZIndex: 36e5,
                    offset: new BMapGL.Size(o[0],o[1]),
                    enableMassClear: !0
                }),
                this.closeBtn.setTitle("清除本次测距"),
                this.scene.map.addOverlay(this.closeBtn);
                var u = {
                    overlay: this.overlay,
                    closeBtn: this.closeBtn,
                    totalLabel: this.totalLabel,
                    lengthLabel: this.lengthLabel,
                    points: this.points.slice(0),
                    turnOverlays: this.turnOverlays.slice(0)
                };
                this.closeBtn.addEventListener("click", (function(e) {
                    t.scene.map.removeOverlay(u.closeBtn),
                    t.scene.map.removeOverlay(u.overlay);
                    for (var n = 0, i = u.turnOverlays.length; i > n; n++)
                        t.scene.map.removeOverlay(u.turnOverlays[n]),
                        u.turnOverlays[n] = null;
                    for (var r = 0, o = u.lengthLabel.length; o > r; r++)
                        t.scene.map.removeOverlay(u.lengthLabel[r]),
                        u.lengthLabel[r] = null
                }
                )),
                this.dispatchMeasureEvent(),
                this.overlay.setPath(this.points),
                this.isSeries ? this.bindEvent() : this.scene.mask.hide()
            }
        }, {
            key: "dispatchMeasureEvent",
            value: function() {
                var e = new T(w.LENGTH_END,{
                    points: this.points ? this.points.slice(0) : [],
                    distance: this.totalLength,
                    subDistance: this.subDistance,
                    unit: this.options.unit,
                    overlay: this.overlay
                });
                this.dispatchEvent(e),
                this.scene.dispatchEvent(e)
            }
        }])
    }(ai)
      , bi = function(e) {
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            return i(this, t),
            (r = n(this, t, [e, o])).measureArea = 0,
            r.turnOverlays = [],
            r.scene.setCurrentDrawType(r.type),
            r.setOtherOptions(o),
            r.isOpen && r.open(),
            r
        }
        return h(t, e),
        o(t, [{
            key: "setOtherOptions",
            value: function(e) {
                this.options = e,
                this.skipEditing = !0,
                this.isOpen = !0,
                this.options = Object.assign(G, e),
                this.isSeries = this.options.isSeries,
                this.setBaseOptions(this.options.baseOpts)
            }
        }, {
            key: "setTurnPoint",
            value: function(e) {
                var t = this.options
                  , n = new BMapGL.Marker(e,{
                    icon: t.turnIcon ? t.turnIcon : x,
                    clickable: !1,
                    baseZIndex: 35e5,
                    zIndexFixed: !0
                });
                this.scene.map.addOverlay(n),
                this.turnOverlays.push(n)
            }
        }, {
            key: "startAction",
            value: function(e) {
                var t = this.match ? this.match : e.point;
                if (this.points.push(t),
                this.drawPoint = this.points.concat(this.points[this.points.length - 1]),
                1 === this.points.length)
                    this.turnOverlays = [],
                    this.overlay = new BMapGL.Polygon(this.drawPoint,this.baseOptions),
                    this.scene.map.addOverlay(this.overlay);
                else if (this.overlay.setPath(this.drawPoint),
                this.points.length > 2) {
                    "metric" === this.options.unit ? (this.measureArea = 1e6 * Kn.getPolygonArea(this.overlay),
                    this.area = this.measureArea.toFixed(2) + "m²") : (this.measureArea = Kn.getPolygonArea(this.overlay),
                    this.area = this.measureArea.toFixed(2) + "km²");
                    var n = Kn.getPolygonCenter(this.overlay.toGeoJSON());
                    this.scene.map.removeOverlay(this.areaLabel),
                    this.areaLabel = this.addLabel(this.area, {
                        position: n.bdCenter,
                        offset: new BMapGL.Size(5,-2)
                    }),
                    this.scene.map.addOverlay(this.areaLabel)
                }
                this.setTurnPoint(t),
                this.isBinded || (this.isBinded = !0,
                this.scene.mask.enableEdgeMove(),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.addEventListener("mousemove", this.mousemove = this.moveAction.bind(this)),
                this.scene.mask.addEventListener("dblclick", this.dblclick = this.dblclickAction.bind(this)))
            }
        }, {
            key: "dblclickAction",
            value: function(e) {
                var t = this;
                D.preventDefault(e),
                D.stopBubble(e),
                this.isBinded = !1,
                this.scene.map.removeOverlay(this.matchOverlay),
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.mask.disableEdgeMove(),
                this.scene.mask.removeEventListener("mousedown", this.mousedown),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.removeEventListener("dblclick", this.dblclick),
                this.overlay.setPath(this.points);
                var n = this.overlay.toGeoJSON().geometry.coordinates[0]
                  , i = new BMapGL.Point(n[n.length - 1][0],n[n.length - 1][1]);
                this.closeIcon = this.options.closeIcon ? this.options.closeIcon : L,
                this.closeBtn = new BMapGL.Marker(i,{
                    icon: this.closeIcon,
                    baseZIndex: 36e5,
                    enableMassClear: !0,
                    offset: new BMapGL.Size(10,10)
                });
                var r = Kn.getPolygonCenter(this.overlay.toGeoJSON());
                this.totalAreaLabel = this.addLabel(this.area, {
                    position: r.bdCenter,
                    offset: new BMapGL.Size(5,-2)
                });
                var o = {
                    overlay: this.overlay,
                    closeBtn: this.closeBtn,
                    points: this.points.slice(0),
                    turnOverlays: this.turnOverlays.slice(0),
                    totalAreaLabel: this.totalAreaLabel
                };
                this.scene.map.addOverlay(o.closeBtn),
                this.scene.map.removeOverlay(this.areaLabel),
                this.scene.map.addOverlay(o.totalAreaLabel),
                o.closeBtn.addEventListener("click", (function(e) {
                    t.scene.map.removeOverlay(o.closeBtn),
                    t.scene.map.removeOverlay(o.overlay),
                    t.scene.map.removeOverlay(o.totalAreaLabel);
                    for (var n = 0, i = o.turnOverlays.length; i > n; n++)
                        t.scene.map.removeOverlay(o.turnOverlays[n]),
                        o.turnOverlays[n] = null
                }
                )),
                this.dispatchMeasureEvent(),
                this.isSeries ? this.bindEvent() : this.scene.mask.hide()
            }
        }, {
            key: "dispatchMeasureEvent",
            value: function() {
                var e = new T(w.AREA_END,{
                    points: this.points ? this.points.slice(0) : [],
                    unit: this.options.unit,
                    area: this.measureArea,
                    overlay: this.overlay
                });
                this.dispatchEvent(e),
                this.scene.dispatchEvent(e)
            }
        }])
    }(li)
      , wi = function(e) {
        function t() {
            var e;
            i(this, t);
            for (var r = arguments.length, o = Array(r), s = 0; r > s; s++)
                o[s] = arguments[s];
            return (e = n(this, t, [].concat(o))).tolerance = 1e-6,
            e.toleranceType = "kilometers",
            e
        }
        return h(t, e),
        o(t, [{
            key: "polygonCutByLine",
            value: function(e, t, n) {
                var i, r, o, s, a, l, h, c, u = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}, p = [], v = [], d = {
                    geojsonRes: null,
                    bdRes: null
                }, f = e.geometry, g = t.geometry;
                if (g.coordinates = (r = [],
                g.coordinates.forEach((function(e) {
                    if (r.length) {
                        var t = r[r.length - 1];
                        t[0] !== e[0] && t[1] !== e[1] && r.push(e)
                    } else
                        r.push(e)
                }
                )),
                r),
                2 > g.coordinates.length)
                    return d;
                if ("Polygon" !== f.type && "MultiPolygon" !== f.type || "LineString" !== g.type)
                    return d;
                if (void 0 === n && (n = ""),
                0 === ht(f, g).features.length)
                    return d;
                if (Wt(g, f))
                    return d;
                v[0] = Tt(g, this.tolerance, {
                    units: this.toleranceType
                }),
                v[1] = Tt(g, -this.tolerance, {
                    units: this.toleranceType
                });
                for (var m = 0; 1 >= m; m++) {
                    var y = m;
                    p = [];
                    for (var b = 0; g.coordinates.length > b; b++)
                        p.push(g.coordinates[b]);
                    for (var w = v[y].geometry.coordinates.length - 1; w >= 0; w--)
                        p.push(v[y].geometry.coordinates[w]);
                    p.push(g.coordinates[0]);
                    var E = Bt(V(p));
                    s = E,
                    a = void 0,
                    l = void 0,
                    h = void 0,
                    c = void 0,
                    a = Me(o = f),
                    l = Me(s),
                    h = o.properties || {},
                    i = 0 === (c = Qn(a.coordinates, l.coordinates)).length ? null : 1 === c.length ? X(c[0], h) : Z(c, h)
                }
                var k = (new BMapGL.GeoJSONParse).readFeaturesFromObject(i, u)
                  , M = []
                  , L = [];
                return k.forEach((function(t, n) {
                    t.properties = Object.assign({}, e.properties || {}),
                    t.properties.id += "-".concat(n),
                    M.push(t),
                    L.push(t.toGeoJSON())
                }
                )),
                {
                    geojsonRes: L,
                    bdRes: M
                }
            }
        }, {
            key: "lineCutByPoly",
            value: function(e, t, n) {
                if (void 0 === e.geometry || -1 === e.geometry.type.toLowerCase().indexOf("linestring"))
                    throw "传入的必须为linestring";
                var i = function(e, t) {
                    if (!e)
                        throw Error("line is required");
                    if (!t)
                        throw Error("splitter is required");
                    var n = Le(e)
                      , i = Le(t);
                    if ("LineString" !== n)
                        throw Error("line must be LineString");
                    if ("FeatureCollection" === i)
                        throw Error("splitter cannot be a FeatureCollection");
                    if ("GeometryCollection" === i)
                        throw Error("splitter cannot be a GeometryCollection");
                    var r = Mt(t, {
                        precision: 7
                    });
                    switch (i) {
                    case "Point":
                        return xt(e, r);
                    case "MultiPoint":
                        return Lt(e, r);
                    case "LineString":
                    case "MultiLineString":
                    case "Polygon":
                    case "MultiPolygon":
                        return Lt(e, ht(e, r))
                    }
                }(e, t).features
                  , r = []
                  , o = new BMapGL.GeoJSONParse;
                if (i.length > 1)
                    for (var s = 0, a = i.length; a > s; s++) {
                        var l = o.readFeatureFromObject(i[s], n);
                        r.push(l)
                    }
                return {
                    geojsonRes: i,
                    bdRes: r
                }
            }
        }])
    }(F)
      , Ei = function(e) {
        function t() {
            var e;
            i(this, t);
            for (var r = arguments.length, o = Array(r), s = 0; r > s; s++)
                o[s] = arguments[s];
            return (e = n(this, t, [].concat(o))).tolerance = .001,
            e.toleranceType = "kilometers",
            e
        }
        return h(t, e),
        o(t, [{
            key: "polygonUnion",
            value: function(e, t) {
                if (2 > e.length)
                    throw "至少2个数据";
                var n = null
                  , i = !1;
                e.forEach((function(e, t) {
                    var r, o, s;
                    1 > t ? n = e : (r = n,
                    s = 6,
                    (o = e).geometry.coordinates[0].forEach((function(e, t) {
                        var n = v(e, 2)
                          , i = n[0]
                          , a = n[1];
                        i = parseFloat(i.toFixed(s)),
                        a = parseFloat(a.toFixed(s));
                        for (var l = 0; r.geometry.coordinates[0].length > l; l++) {
                            var h = v(r.geometry.coordinates[0][l], 2)
                              , c = h[0]
                              , u = h[1];
                            if (c = parseFloat(c.toFixed(s)),
                            u = parseFloat(u.toFixed(s)),
                            i === c && a === u) {
                                o.geometry.coordinates[0][t] = r.geometry.coordinates[0][l];
                                break
                            }
                        }
                    }
                    )),
                    Wt(n, e) ? i = !0 : n = Hn(n, e))
                }
                ));
                var r = i ? null : n
                  , o = new BMapGL.GeoJSONParse;
                return {
                    geojsonRes: r,
                    bdRes: r ? o.readFeatureFromObject(r, t) : null
                }
            }
        }])
    }(F)
      , ki = function(e) {
        function t() {
            return i(this, t),
            n(this, t, arguments)
        }
        return h(t, e),
        o(t, [{
            key: "geojsonMove",
            value: function(e, t, n) {
                (t instanceof BMapGL.Point || t instanceof BMapGL.LatLng) && (t = J([t.lng, t.lat])),
                (n instanceof BMapGL.Point || n instanceof BMapGL.LatLng) && (n = J([n.lng, n.lat]));
                var i, r, o, s, a = function(e, t, n, i) {
                    if (!oe(i = i || {}))
                        throw Error("options is invalid");
                    var r = i.units
                      , o = i.zTranslation
                      , s = i.mutate;
                    if (!e)
                        throw Error("geojson is required");
                    if (null == t || isNaN(t))
                        throw Error("distance is required");
                    if (o && "number" != typeof o && isNaN(o))
                        throw Error("zTranslation is not a number");
                    if (o = void 0 !== o ? o : 0,
                    0 === t && 0 === o)
                        return e;
                    if (null == n || isNaN(n))
                        throw Error("direction is required");
                    return 0 > t && (t = -t,
                    n += 180),
                    !1 !== s && void 0 !== s || (e = Pe(e)),
                    ae(e, (function(e) {
                        var i = Ee(Rt(e, t, n, {
                            units: r
                        }));
                        e[0] = i[0],
                        e[1] = i[1],
                        o && 3 === e.length && (e[2] += o)
                    }
                    )),
                    e
                }(e, pt(t, n), (i = t,
                r = n,
                void 0 === o && (o = {}),
                (s = o.final ? It(we(r), we(i)) : It(we(i), we(r))) > 180 ? -(360 - s) : s));
                return a
            }
        }])
    }(F)
      , Mi = function(e) {
        function t(e) {
            var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
            if (i(this, t),
            (r = n(this, t)).currentModel = t.MODEL.MOVE,
            r.labelOptions = P,
            r.baseOpts = I,
            r.enableSnap = !0,
            r.snapDistance = 10,
            r.match = null,
            r.matchOverlay = null,
            r.matchOverlayRadius = 1,
            !(e instanceof ei))
                throw Error("MoveBase实例化必须输入scene参数");
            r.scene = e,
            r.scene.move = r;
            var s = {};
            return D.copyOptionsToNew(r.scene.options, o, s),
            D.copyNotExitOptions(s, r.scene.options),
            r.options = s,
            r.target = o.target || r,
            r.setOptions(s),
            r.setSnapPointType(o),
            r.moveCalculate = new ki,
            r.parse = new BMapGL.GeoJSONParse,
            r
        }
        return h(t, e),
        o(t, [{
            key: "setOptions",
            value: function() {
                this.defineProperty(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {})
            }
        }, {
            key: "setCurrentModel",
            value: function(e) {
                this.currentModel = e
            }
        }, {
            key: "open",
            value: function(e, n) {
                var i = this;
                this.scene && (this.overlay = this.currentModel === t.MODEL.MOVE ? e : this.parse.readFeatureFromObject(e.toGeoJSON()),
                this.scene.open(),
                this.setRunningAction(!0, (function() {
                    i.setSceneStatus(y.STATUS_MOVE),
                    i.moveOpe(e),
                    n && n()
                }
                )))
            }
        }, {
            key: "close",
            value: function(e) {
                this.overlay && (this.setRunningAction(!1),
                this.setSceneStatus(y.STATUS_FREE),
                this.closeOpe(this.overlay),
                this.emitOkEvent(this.overlay),
                e && e())
            }
        }, {
            key: "moveOpe",
            value: function(e) {}
        }, {
            key: "closeOpe",
            value: function(e) {}
        }, {
            key: "emitOkEvent",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
                  , n = new T(b.COMPLETE,{
                    overlay: e,
                    from: E.MOVE_ON_MAP,
                    model: this.currentModel
                });
                this.dispatchEvent(n),
                t && this.scene.dispatchEvent(n)
            }
        }, {
            key: "setRunningAction",
            value: function(e, t) {
                e ? (this.scene.closeRunningAction(),
                this.scene.runningAction = this,
                this.scene.mask.show(),
                t()) : (this.scene.runningAction = null,
                this.scene.mask.hide())
            }
        }, {
            key: "setRadius",
            value: function() {
                var e = this.scene.map.getZoomUnits();
                this.matchOverlay.setRadius(this.matchOverlayRadius * e)
            }
        }, {
            key: "addMatchOverlay",
            value: function(e) {
                this.matchOverlay instanceof BMapGL.Circle ? (this.setRadius(),
                this.matchOverlay.setCenter(e),
                this.scene.map.addEventListener("zoomend", this._setRadius = this.setRadius.bind(this)),
                this.scene.map.addOverlay(this.matchOverlay)) : (this.scene.map.addOverlay(this.matchOverlay),
                this.matchOverlay.setPosition(e))
            }
        }, {
            key: "removeMatchOverlay",
            value: function() {
                this.scene.map.removeOverlay(this.matchOverlay),
                this._setRadius && this.scene.map.removeEventListener("zoomend", this._setRadius)
            }
        }, {
            key: "getSnap",
            value: function(e) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.scene.instances
                  , n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : []
                  , i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : this.snapDistance
                  , r = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : this.scene.map
                  , o = null;
                return this.removeMatchOverlay(),
                o || (o = ti(e, t, i, r)),
                !o && this.scene._attachSnapSource && (o = ti(e, this.scene._attachSnapSource, i, r)),
                o || (o = ti(e, n, i, r)),
                o && this.addMatchOverlay(o),
                o
            }
        }])
    }(F);
    Mi.MODEL = {
        COPY: Symbol(),
        MOVE: Symbol()
    };
    var Li = function(e) {
        function t(e, r) {
            var o;
            return i(this, t),
            (o = n(this, t, [e, r])).type = k.DRAWING_POLYLINE,
            o.scene.setCurrentDrawType(o.type),
            o
        }
        return h(t, e),
        o(t, [{
            key: "startAction",
            value: function(e) {
                D.stopBubble(e),
                D.preventDefault(e),
                this.start = this.match ? this.match : e.point,
                this.currentModel === Mi.MODEL.COPY && (this.overlay.setOptions(this.baseOpts),
                this.scene.map.addOverlay(this.overlay)),
                this.scene.mask.enableEdgeMove(),
                this.scene.mask.removeEventListener("mousedown", this.mousedown),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.addEventListener("mousemove", this.mousemove = this.moveAction.bind(this)),
                this.scene.mask.addEventListener("mouseup", this.mouseup = this.endAction.bind(this))
            }
        }, {
            key: "moveAction",
            value: function(e) {
                D.preventDefault(e),
                D.stopBubble(e),
                this.scene.map.removeOverlay(this.tipLabel),
                this.tipLabel = new BMapGL.Label("移动改变位置<br>松开结束操作",{
                    position: e.point,
                    offset: new BMapGL.Size(10,10)
                }),
                this.tipLabel.setStyle(this.labelOptions),
                this.scene.map.addOverlay(this.tipLabel);
                var t = e.point;
                this.enableSnap && (this.match = this.currentModel === Mi.MODEL.COPY ? this.getSnap(e.point, this.scene.instances) : this.getSnap(e.point, this.scene.instances, [], this.snapDistance, this.scene.map, [this.overlay]),
                this.match && (t = this.match),
                this.match = null);
                var n = this.moveCalculate.geojsonMove(this.source, this.start, t);
                this.overlay.updateByGeoJSON(n)
            }
        }, {
            key: "endAction",
            value: function(e) {
                D.preventDefault(e),
                D.stopBubble(e),
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.map.removeOverlay(this.matchOverlay),
                this.scene.mask.removeEventListener("mousemove", this.mousemove),
                this.scene.mask.removeEventListener("mouseup", this.mouseup),
                this.scene.mask.disableEdgeMove(),
                this.finish()
            }
        }, {
            key: "mousemoveAction",
            value: function(e) {
                D.preventDefault(e),
                D.stopBubble(e),
                this.enableSnap && (this.match = this.getSnap(e.point, this.scene.instances)),
                this.scene.map.removeOverlay(this.tipLabel),
                this.tipLabel = new BMapGL.Label("按住确认起点，拖拽进行移动",{
                    position: e.point,
                    offset: new BMapGL.Size(10,10)
                }),
                this.tipLabel.setStyle(this.labelOptions),
                this.scene.map.addOverlay(this.tipLabel)
            }
        }, {
            key: "finish",
            value: function() {
                this.currentModel === Mi.MODEL.COPY && this.scene.map.removeOverlay(this.overlay),
                this.emitOkEvent(this.overlay, !0);
                var e = new T(b.CHANGE,this.overlay);
                this.target.dispatchEvent(e),
                this.close()
            }
        }, {
            key: "moveOpe",
            value: function() {
                this.source = this.overlay.toGeoJSON(),
                this.scene.mask.show(),
                this.scene.mask.addEventListener("mousemove", this.mousemove = this.mousemoveAction.bind(this)),
                this.scene.mask.addEventListener("mousedown", this.mousedown = this.startAction.bind(this))
            }
        }, {
            key: "closeOpe",
            value: function() {
                this.scene.map.removeOverlay(this.tipLabel),
                this.scene.map.removeOverlay(this.matchOverlay),
                this.scene.mask.removeEventListener("mouseup", this.mouseup),
                this.scene.mask.removeEventListener("mousedown", this.mousedown),
                this.scene.mask.removeEventListener("mousemove", this.mousemove)
            }
        }])
    }(Mi)
      , xi = function(e) {
        function t(e, r) {
            var o;
            return i(this, t),
            (o = n(this, t, [e, r])).type = k.DRAWING_POLYGON,
            o.scene.setCurrentDrawType(o.type),
            o
        }
        return h(t, e),
        o(t)
    }(Li)
      , Oi = function(e) {
        function t(e, r) {
            var o;
            return i(this, t),
            (o = n(this, t)).otherOverlays = [],
            o.snapDistance = 15,
            o.isOpen = !1,
            o.cursor = "default",
            o.scene = e,
            o.isOpen = ~~r,
            o._initEvent(),
            o
        }
        return h(t, e),
        o(t, [{
            key: "open",
            get: function() {
                return this.isOpen
            },
            set: function(e) {
                this.isOpen = e
            }
        }, {
            key: "distance",
            get: function() {
                return this.snapDistance
            },
            set: function(e) {
                this.snapDistance = e
            }
        }, {
            key: "setPickCursor",
            value: function(e) {
                this.cursor = e
            }
        }, {
            key: "_initEvent",
            value: function() {
                var e = this;
                this.scene && (this.scene.addEventListener(b.CLICK, (function(t) {
                    if (e.isOpen && e.scene.currentStatus === y.STATUS_FREE) {
                        var n = e.getSnap(t.target.latlng);
                        if (n) {
                            var i = v(n, 3)
                              , r = new Si(i[0],i[1]);
                            e.dispatchEvent(new T(b.CLICK,r))
                        }
                    }
                }
                )),
                this.scene.addEventListener(b.MOVE, (function(t) {
                    if (e.isOpen && e.scene.currentStatus === y.STATUS_FREE) {
                        var n = e.getSnap(t.target.latlng);
                        if (n) {
                            e.scene.map.platform.style.cursor = e.cursor;
                            var i = v(n, 3)
                              , r = new Si(i[0],i[1]);
                            e.dispatchEvent(new T(b.MOVE,r))
                        } else
                            e.scene.map.platform.style.cursor = e.scene.map.config.defaultCursor,
                            e.dispatchEvent(new T(b.MOVE,null))
                    }
                }
                )))
            }
        }, {
            key: "attachOverlays",
            value: function(e) {
                e instanceof Array && (this.otherOverlays = e)
            }
        }, {
            key: "getSnap",
            value: function(e) {
                var t = null;
                return t || (t = this.getSnapByLL(e, this.scene.instances)),
                !t && this.otherOverlays && this.otherOverlays.length > 0 && (t = this.getSnapByLL(e, this.otherOverlays)),
                t
            }
        }, {
            key: "getSnapByLL",
            value: function(e, t) {
                var n, i = (n = this.scene.map.getZoom(),
                Math.pow(2, 18 - n)), r = this.snapDistance * i;
                if (!(t && t instanceof Array))
                    return null;
                for (var o in t) {
                    var s = t[o];
                    if (s instanceof BMapGL.Marker) {
                        var a = s.getPosition();
                        if (r > 1e3 * Kn.getDistance(e, a, "kilometers"))
                            return [s, 0, a]
                    } else {
                        var l = s.getPath();
                        for (var h in l) {
                            var c = l[h]
                              , u = 1e3 * Kn.getDistance(e, c, "kilometers");
                            if (u && r > u)
                                return [s, h, c]
                        }
                    }
                }
                return null
            }
        }])
    }(F)
      , Si = function(e) {
        function t(e, r) {
            var o;
            return i(this, t),
            (o = n(this, t))._index = -1,
            o.overlay = e,
            o.path = e instanceof BMapGL.Marker ? [e.getPosition()] : e.getPath(),
            r > o.path.length - 1 || (o.index = r),
            o
        }
        return h(t, e),
        o(t, [{
            key: "index",
            get: function() {
                return this._index
            },
            set: function(e) {
                this._index = parseInt(e) || 0;
                var t = new T(b.CHANGE,this.index);
                this.dispatchEvent(t)
            }
        }, {
            key: "getCurrentNode",
            value: function() {
                return this.path[this.index]
            }
        }, {
            key: "updateNode",
            value: function(e, t) {
                if (this.overlay instanceof BMapGL.Marker) {
                    var n = BMapGL.Projection.convertLL2MC(e);
                    this.overlay.setPoint(n)
                } else
                    void 0 !== t && t >= 0 && this.path.length > t ? this.path[t] = e : this.path[this.index] = e,
                    this.overlay.setPath(this.path)
            }
        }, {
            key: "hasNext",
            value: function() {
                return this.index + 1 >= 0 && this.path.length > this.index + 1
            }
        }, {
            key: "next",
            value: function() {
                return this.hasNext() ? (this._index++,
                this.path[this.index]) : null
            }
        }, {
            key: "hasPrev",
            value: function() {
                return this.index - 1 >= 0 && this.path.length > this.index - 1
            }
        }, {
            key: "prev",
            value: function() {
                return this.hasPrev() ? (this._index--,
                this.path[this.index]) : null
            }
        }])
    }(F);

    e.ActionStatus = E,
    e.AreaMeasure = bi,
    e.CircleDraw = vi,
    e.CircleEdit = pi,
    e.CorrectPoint = Oi,
    e.CutCalculate = wi,
    e.DistanceMeasure = yi,
    e.DrawControl = fi,
    e.DrawScene = ei,
    e.DrawStatus = y,
    e.DrawingType = k,
    e.GeoCalculator = Kn,
    e.MapSelect = W,
    e.MarkerDraw = ii,
    e.MarkerEdit = di,
    e.Measure = mi,
    e.MeasureEvent = w,
    e.MoveCalculate = ki,
    e.Operate = qn,
    e.OperateEventType = b,
    e.PolygonDraw = li,
    e.PolygonEdit = si,
    e.PolygonMove = xi,
    e.PolylineDraw = ai,
    e.PolylineEdit = oi,
    e.PolylineMove = Li,
    e.RectDraw = ui,
    e.RectEdit = ci,
    e.Select = gi,
    e.UnionCalculate = Ei,
    Object.defineProperty(e, "__esModule", {
        value: !0
    })
}
));
